Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/86.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 Wordpress分页返回的每页文章数不一致_Php_Sql_Wordpress_Pagination - Fatal编程技术网

Php Wordpress分页返回的每页文章数不一致

Php Wordpress分页返回的每页文章数不一致,php,sql,wordpress,pagination,Php,Sql,Wordpress,Pagination,通过使用带有分页的wordpress wp_查询和以下设置: $args = array ( 'paged' => $paged, 'posts_per_page' => 50, 'ignore_sticky_posts'=>true, 'post_type' => 'place', 'meta_query' => array( 'relation' => 'AND', $query )); 我得到的第1页上的SQL

通过使用带有分页的wordpress wp_查询和以下设置:

$args = array (
  'paged' => $paged,
  'posts_per_page' => 50,
  'ignore_sticky_posts'=>true,
  'post_type'   => 'place',
  'meta_query'  => array(
  'relation'    => 'AND',
   $query
));
我得到的第1页上的SQL是:

string(997) "SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts
...
...
...
ORDER BY wp_posts.post_date DESC LIMIT 0, 50" string(4) "1472"

但为什么这个页面上显示的帖子数量只有48篇而不是50篇?不同的页面每页显示不同的帖子,例如14、27。。等等。有人能帮我了解发生了什么吗?

添加
'post\u status'=>'publish'
参数添加
'post\u status'=>'publish'
参数