How to Exclude a Category from your Blog Feed

The are many reasons why you may want to exclude a specific blog category from your RSS feed. The most often excluded blog category for us is testimonials, which is often pulled to use as rotation text somewhere on a website.

Setting your client testimonials up as a blog category makes it easy to add and mange them but excluding them from your blog feed takes a little effort, but not much.

All you need to do is add a few lines of code to the functions.php file in your theme:

function exclude($query) {
if ($query->is_feed) {
return $query;

In the code above simply replace the category ID number with the category ID on your blog that you want to exclude.

If you don’t have a functions.php file in your theme, you can create a new file in Notepad, just type <?php  the above code and ?> after the code,  then save and upload to your theme’s folder.

And that’s it.

Cosmetic Enhancement Center of New England

Tiffiny is amazing to work with. I have worked with many website developers and have never been truly happy until now. Tiffiny and her staff are prompt to do changes and updates. She redesigned my whole site within days and it is more beautiful than ever.

I would wholeheartedly recommend her for quality, speed, and price.

Maria Atkins DO
Portland, ME