wordpress snippets last updated   : January 29, 2015
we now have 646 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
          query_posts($query_string . '&cat=-3'); 

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