• hello there,

    I have a blog with 244 post in it within the only category (id=1)

    i am trying to set up a pagination plugin (wp-page-numbers) and met following issue
    with 24 posts per page I got only 9 pages in my navi 1 2 … 9
    but I should have 244/24 = 10.1 – at least 11 pages

    after some investigations I found out that ->found_posts returs only 216 – thus 28 posts were invisible for found_posts property..

    after that a went through my posts and got following distribution:
    March = 120 posts
    Feb = 96 posts
    Jan = 28 posts

    so it looks like by default found_posts “sees” only posts from Mar and Feb, but cannot see early posts..

    anybody could help me with idea where should I dig in?

Viewing 1 replies (of 1 total)
  • See what happens with this:

    <?php
    $cat_id = get_cat_ID('events');
    $args=array(
      'cat' => $cat_id,
      'post_type' => 'post',
      'post_status' => 'publish',
      'showposts' => -1
    );
    $catposts=get_posts($args);
    echo 'posts found '. count($catposts);
    ?>

    Might also deactivate all plugins and change to WordPress Default theme.

Viewing 1 replies (of 1 total)
  • The topic ‘$wp_query->found_posts returns incorrect number of posts’ is closed to new replies.