Query posts effecting search results
-
I’m wondering if anyone else has run into this. I have an issue with the built in search and query posts. On my index.php page, I have a query post above the -if has- posts line, which tells it to show all but category 3, like so:
<?php query_posts( 'cat=-3' ); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ...... bunch o' stuff ...... <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?>
This works, however, when searching for a word that I know only appears in one post, instead of displaying that one post, the search results dump out every post (excluding category 3 items). If I search for a word that doesn’t exist, this works correctly, telling me that there are no results for that search term.
If I remove the query post, the search works correctly, only showing the one post that uses that word.
Does anyone know how to resolve this? Thanks in advance for any help you might have.
- The topic ‘Query posts effecting search results’ is closed to new replies.