Tutorials
Exclude A Category From Your WordPress Feed
Last Updated on February 5, 2023 · No Comments on 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!
No comments yet. Why don't you kick off the discussion?