WP_Query skipping pages
-
I’m debugging a plugin, and found something strange I could isolate to this short code. It counts the number of pages in the DB:
`$myQuery = new WP_Query();
$myQuery->query(‘post_type=page’);
$numberOfPages = 0;
while ($myQuery->have_posts())
{
$numberOfPages++;
$myQuery->the_post();
}
echo $numberOfPages;`The problem is I get 10, while there are 12 published pages in the DB. How can that happen?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘WP_Query skipping pages’ is closed to new replies.