Skip to main content
Easily create better & faster websites with the Total WordPress Theme Learn More
(opens a new tab)
Tutorials

Exclude A Category From Your WordPress Feed

This is just a really quick function for those looking to exclude a specific category from their WordPress Feed. All you need to do is copy and paste the function below into your functions.php file and then change the “99” value to reflect the category ID you with to exclude/disable in your feed.

 //exclude category with ID 99 from your feed
 function myFilter($query) {
 if ($query->is_feed) {
 $query->set('cat','-99');
 }
 return $query;
 }
add_filter('pre_get_posts','myFilter');

Excluding Categories FromĀ  Your Feed With A Plugin

On of the cool things about WordPress is that there is a plugin for virtually everything. So if you rather stay away from editing your files you can download the “Ultimate Category Excluder Plugin” instead. This plugin will allow you to exclude categories from your ront page, archives, and feeds. Enjoy!

Comments

No comments yet. Why don't you kick off the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed by viewing our privacy policy here.