WordPress.org

Support

Support » How-To and Troubleshooting » found_posts is always zero

found_posts is always zero

  • In link-template.php:

    function next_posts_link($label=’Next Page »’, $max_page=0) {
    global $paged, $wpdb, $wp_query;
    $foo = $wp_query->found_posts;
    echo “found_posts = ” . $foo;
    if ( !$max_page ) {
    $max_page = $wp_query->max_num_pages;
    }

    and so on.

    This always prints a zero.

    Unless a max_page is supplied by the template, max_page (which is computed from found_posts in query.php) will be zero. Consequently, previous entries will never be shown.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘found_posts is always zero’ is closed to new replies.