Skip to Main Content

How to exclude certain categories from the RSS feed on WordPress

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 600.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

Do you want to exclude specific categories from the RSS feed of your WordPress blog? Many site owners use certain categories with content that they do not want to see appear on their RSS feed.

In this tutorial, we will show you how to exclude specific categories from the RSS feed of WordPress.

category exclusions from the WordPress feed

1 method: exclude specific categories with a plugin

The first thing you need to do is to install and activate the plugin " Ultimate Category Excluder ". For more details, check out our step-by-step guide on how to install a WordPress plugin.

After activating the plugin, you must visit to access Settings> Category Exclusion To configure the plugin settings.

ultimate category excluder example settings

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

The settings page displays all the categories on your WordPress blog with options to hide them on the blog homepage, RSS feeds, archive pages, and search results.

Just select one of the boxes under the column Exclude from feeds And choose the category you want to hide. Do not forget to save your settings.

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

From now on, the categories you have selected will not appear in your RSS feed.

2 Method: Manually Exclude Categories from RSS Feed

This method requires you to paste a code into your WordPress files. You can use this method if you are comfortable with editing WordPress code.

You can add this code in the file " functions.php Of your active theme or paste it into your WordPress plugin (we showed you how to create a WordPress plugin).

function exclude_category($query) {
    if ( $query->is_feed ) {
        $query->set('cat', '-5, -2, -3');
    }
return $query;
}
add_filter('pre_get_posts', 'exclude_category');

This code simply excludes categories that correspond to the given identifiers. Just replace the category IDs in the code with the IDs of the categories you want to exclude.

You will easily find the category IDs by modifying a category. This is usually the number in the browser URL.

Categorie wordpress

If you want to exclude a single category, you can use this code:

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

function exclude_category($query) {
    if ( $query->is_feed ) {
        $query->set('cat', '-15');
    }
return $query;
}
add_filter('pre_get_posts', 'exclude_category');

Replace -15 with the ID of the category you want to exclude from RSS feeds.

That's all for this tutorial, I hope it will allow you to exclude articles from the RSS feed with ease. Do not hesitate to contact us in case of problems.

This article features 0 comments

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top
3 shares
Share2
tweet
Save1