WordPress.org

Ready to get started?Download WordPress

Forums

Post count different from search results... (2 posts)

  1. nicetechnology
    Member
    Posted 1 year ago #

    So, I've got landing pages for each of my custom taxonomies (restaurant review site so 'cuisines' etc), and I use the following to get the post count for each of them when I make the list...

    $args = array(
    'taxonomy' => 'cuisine',
    'show_count' => true,
    'hierarchical' => true,
    'echo' => '0',
    'title_li' => NULL,
    'child_of' => $term->term_id,
    'pad_counts' => 0
    );
    echo wp_list_categories($args);

    ... which gives a list with a count of the number of posts in each category. Clicking these items takes you to a search result page, which shows all the posts in that category, as it should. The problem is the number of posts is reported differently in each case. For example clicking...

    Pizza (12)

    ... takes you to a search result page which uses the following...

    $search_object->found_posts;

    ... to give the number of results. In this case the search results page shows 11 NOT 12! Why? In the admin area I get the same; the number next to 'pizza' says '12', but clicking it shows exactly 11 results...

    Can anyone help me?!? I'm going mad here...

    Thanks,

    J

  2. Peter_L
    Member
    Posted 1 year ago #

    Perhaps an accidental post with a double category? Do you get this on other categories?

Topic Closed

This topic has been closed to new replies.

About this Topic