Do you want to exclude specific categories from the RSS feed on your WordPress site? Many site owners use some categories for content that they don't want to appear in their site's RSS feed. In this article, we will show you how to exclude specific categories from WordPress RSS feed.
The first thing you need to do is install and activate the Ultimate Category Excluder plugin. For more details, check out our step-by-step guide on how to install a WordPress plugin.
After activation it is necessary to visit Settings »Category exclusion to configure the plugin settings.
The settings page will display all the categories on your WordPress blog with options to hide them from the front page, RSS feeds, archive pages, and search results.
Simply select the feed exclusion box next to the categories you want to exclude from your RSS feed.
Don't forget to click the Update button to save your settings.
That's it, the posts filed in the selected categories will disappear from your WordPress RSS feed.
This method requires you to paste the code into your WordPress files. You can use this method if you feel comfortable pasting code snippets from the web into WordPress.
You need to add this code to your theme's functions.php file or to a site-specific plugin.
función exclude_category ($ consulta) si ($ consulta-> is_feed) $ consulta-> set ('cat', '-5, -2, -3'); devolver $ consulta; add_filter ('pre_get_posts', 'exclude_category');
This code simply excludes the categories that match the given IDs. Just replace the category IDs in the code with the category IDs you want to exclude.
See our guide on how to find category IDs in WordPress.
If you only want to exclude a single category, change the code like this:
función exclude_category ($ consulta) si ($ consulta-> is_feed) $ consulta-> set ('cat', '-15'); devolver $ consulta; add_filter ('pre_get_posts', 'exclude_category');
Replace -15 with the ID of the category you want to exclude from the RSS feed.
We hope this article helped you learn how to exclude specific categories from WordPress RSS feed. You may also want to see our list of the 10 most wanted category hacks and plugins for WordPress.
If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.