Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WP_Query()不会返回所有条目_Php_Wordpress - Fatal编程技术网

Php WP_Query()不会返回所有条目

Php WP_Query()不会返回所有条目,php,wordpress,Php,Wordpress,我有一个查询,它只返回表中的几个条目。我有超过10篇文章,但这个查询只返回6篇。请帮忙提建议 $query = new WP_Query("year=2011&monthnum=09&post_status=publish&post_type=post&orderby=post_date&order=DESC"); while ($query->have_posts()): $query->the_post(); $title=

我有一个查询,它只返回表中的几个条目。我有超过10篇文章,但这个查询只返回6篇。请帮忙提建议

$query = new WP_Query("year=2011&monthnum=09&post_status=publish&post_type=post&orderby=post_date&order=DESC");
while ($query->have_posts()):
    $query->the_post();
    $title=get_the_Title();                                                                                                                  
    echo"<p><input type=\"checkbox\" name=\"MyArticle[]\" value=\"".get_the_ID()."\">".get_the_Title()."</p>";
endwhile;               
wp_reset_query();
$query=new WP\u query(“年=2011月=09月&post\u状态=publish&post\u类型=post&orderby=post\u日期&order=DESC”);
而($query->have_posts()):
$query->the_post();
$title=获取标题();
回显“”。获取标题();
结束时;
wp_reset_query();

尝试将
posts\u per\u page=-1
添加到传递给
WP\u Query
的参数字符串中

如果未设置该值,则返回到使用您在
设置>>阅读>>博客页面中设置的默认每页文章选项,最多显示


我猜这个值是6,因为没有指定不同的限制,所以它返回了那么多帖子。

“year=2011&monthnum=09&post\u status=publish&post\u type=post&orderby=post\u date&order=DESC”
WP\u查询
类的驱动力。我的猜测是,其中4篇文章没有一个适当的年份、月份或发布状态。这将是正确的答案,无论点击回答与否。谢谢这解决了查询根本不返回任何内容的问题。这发生在帖子达到一定年龄后。这让他们都回来了!谢谢@drew010。。我因为列出这些页面而被耽搁了2天。。谢谢。。每页的帖子帮助我工作。但是有人能说出它背后的逻辑吗?谢谢你指出默认值的来源!
$args = array(
    'post_type' => 'product',
    'orderby' => 'ASC',
    'posts_per_page'=>-1
);
$wp_query = new WP_Query($args);