WP查询以获取所有帖子(包括草稿/待审稿) 时间:2012-02-27 作者:Kyle 我目前有以下查询:$args = array( \'post_type\' => \'post\', \'orderby\' => \'title\', \'order\' => \'ASC\', \'posts_per_page\' => 10, ); $my_query = new WP_Query($args); while ($my_query->have_posts()) : $my_query->the_post(); ?> 这将返回已发布的所有帖子。我如何修改它以显示每一篇文章,无论是已发布的、待定的还是草稿中的? 2 个回复 最合适的回答,由SO网友:Rachel Baker 整理而成 您可以将post\\u status添加到查询中,字符串“any”将返回所有帖子,无论其状态如何,也可以使用数组来获取所需的帖子。$args = array( \'post_type\' => \'post\', \'orderby\' => \'title\', \'order\' => \'ASC\', \'post_status\' => \'any\', \'posts_per_page\' => 10, ); http://codex.wordpress.org/Class_Reference/WP_Query#Status_Parameters SO网友:Çağdaş Takış 您还可以自定义挂起和草稿或任何选定状态$args = array( \'post_type\' => \'post\', \'orderby\' => \'title\', \'order\' => \'ASC\', \'post_status\' => array( \'pending\', \'draft\', \'future\' ), \'posts_per_page\' => 10, ); 结束 文章导航