wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Exclude cat from search

wordpress snippet

Adding this PHP code just above the loop in your wordpress search.php template. Make sure to place a - minus before the category ID you wish to exclude.

snippet :  PHPcopy
<?php
          query_posts($query_string . '&cat=-3');
?>

Did you like this post? If so please share it with your friends. Thanks!