REALITYPOD
Realitypod

How to Remove a Category from RSS Feed – WordPress

A while ago, we started a category where users could submit videos and interesting links. But since those links/ videos were too many, it looked like junk to our RSS readers. Hence the only way to overcome this problem was to remove the particular category from our RSS feed. Although there are many plugins to do this job, it always better to add a line of code and solve the problem instead of adding junky codes into your website.

Problem

Remove Category from RSS Feed.

Solution

Add the following code in your functions.php file

function myFilter($query) {
if ($query->is_feed) {
$query->set(‘cat’,’-12′); //Don’t forget to change the category ID
}
return $query;
}

add_filter(‘pre_get_posts’,’myFilter’);

Note: In the above code, I have assumed that the category you wanted to remove from RSS feed was 12. To find your category ID in wordpress, follow this guide.

Related posts

Top Ten Military Tanks

Realitypod

How Celebrities Looked Like When They Were Young

Realitypod

Activation of iOS 5 Beta 1 Firmware

Realitypod