I received an email asking if a category could be excluded or hidden in her RSS Feed. She is using MailChimp’s RSS-to-Email and does not want a category for her personal blogs to show up in her newsletter.
The answer is Yes.
*Note: This should only be done with one category. If the blog is in more than one category, there is a chance the blog may still show up in the feed.
Find the Category ID
The first thing you need to do is locate the ID number of the category. You can do this by editing the category. Then look in the address bar for the ID number as shown below. Or you can install the Reveal IDs plugin to add the ID column to your pages, posts, categories and tags.
Adding the Code
- Using your FTP program or in your File Manager of your hosting account, browse over to your Child Theme Folder (i.e., Foodie Pro, Brunch Pro, etc.).
- Open the Functions.php file.
- Copy and paste the following code to the bottom (be sure to add a new line before pasting).
- On Line 4, change the number “7” to your category ID.
- Save it.
https://gist.github.com/cre8tivediva/64cd8c3f4a7ef9412628020f957411da#file-functions-php
Then visit your RSS feed. If items from that category still show up, you may be using a caching plugin. As such, you will need to flush/clear the cache to get a clean view of your RSS Feed.
That’s it!