Support » Fixing WordPress » Search Results Problem

  • Resolved ghostpool


    I’m in the middle of creating a new theme and after testing my search results it seems one of the results is always excluded. So for example the $wp_query->found_posts will say I have 14 search results but only 13 are shown, or if I have 1 result 0 are shown. Switching back to the default theme fixes the issue so it’s definitely something in my theme causing it. I’ve removed everything from the theme bit by bit to try and find the cause but nothing fixes it. I’m pretty sure I’ve closed all queries and/or reset queries and the search has no custom query.

    Has anyone come across such an issue before and have any suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • To add to my previous post, unsurprisingly it is all loops that are missing one post, the latest post. I just can’t find the source of the problem.

    Maybe something in the functions.php filtering/excluding from queries?

    I’m going to go over the functions.php file again. I really removed everything from it last time and the problem still occurred, but maybe I missed something. The queries on the index page work fine, but all other queries e.g. categories, search results etc. are affected. It’s as if an offset=1 hasn’t been closed and affecting everything.

    The great mystery is solved.

    Notice something:

    <?php if(have_posts()) : the_post(); while(have_posts()) : the_post(); ?>

    For some reason I added an extra the_post. :S

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search Results Problem’ is closed to new replies.