WordPress tutorials: Exclude categories

Wpsnipp  – Exclude categories.Adding this PHP code to your wordpress functions.php file will allow you to exclude categories from your RSS feeds. Make sure to use a minus before the category id.This is probably the fastest way to exclude category in WordPress besides using a plugin.



Dump this code anywhere in Theme’s template ‘function.php’file (For example, ‘function.php’ file for a Theme named “default” would probably reside in the directory wp-content/themes/default/functions.php):

function excludeCat($query)
   if ($query->is_feed)
   return $query;

Be Sociable, Share!

Leave a comment