October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Exclude Specific Categories from WordPress RSS Feeds

Exclude selected categories from WordPress’s main RSS feed with a scoped query change, and test category-specific feeds separately if you need to retain them.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To keep selected categories out of WordPress’s main RSS feed, exclude their category IDs from the feed query. The most controlled way is a small pre_get_posts callback that changes only the main feed query. You can still keep category-specific feeds available, but test those feed URLs separately after the change.

Choose the right way to exclude categories

WordPress supports category exclusions through query variables. The two practical routes are a code hook or a feed URL/plugin control. The best fit depends on whether you want a site-level change, how comfortable you are maintaining PHP, and whether child categories should also be excluded.

Approach Where it applies What to maintain Child-category behavior
pre_get_posts with category__not_in Can be scoped to the main feed query; an overly broad callback can affect other queries. Category IDs and the PHP callback. The category__not_in exclusion does not include child categories, according to the WP_Query reference.
Negative IDs in the cat query parameter Feed URL or plugin controls, depending on how the URL is used. Category IDs in the URL or plugin settings. The reference documents this exclusion form, but does not establish that it has identical edge-case behavior to category__not_in.
RSS Control plugin The plugin listing describes feed URL controls and category-exclusion examples. Plugin settings and compatibility with your current WordPress setup. Check the plugin’s current behavior and compatibility; the listing does not establish every theme or plugin interaction.

Exclude categories from the main feed with PHP

The pre_get_posts hook runs before a query executes and lets you change its query variables. The important safeguard is to check that the request is not in the admin area, that the query is the main query, and that it is a feed before setting exclusions. See the WordPress developer reference for pre_get_posts.

  1. Find the numeric IDs of the categories you want to omit. You can inspect a category’s edit link in WordPress to locate its ID.
  2. Add the callback below to a site-specific plugin or your theme’s functions.php. A site-specific plugin is easier to keep active if you later change themes.
  3. Replace 12 and 34 with the category IDs to exclude.
  4. Save the change and test the main feed and any category feeds you intend to preserve.
add_action( 'pre_get_posts', 'my_exclude_categories_from_feed' );
function my_exclude_categories_from_feed( $query ) {
    if ( is_admin() || ! $query->is_main_query() || ! $query->is_feed() ) {
        return;
    }

    $query->set( 'category__not_in', array( 12, 34 ) );
}

This example is deliberately limited to the main feed query. Do not remove those checks casually: changing query variables without appropriate conditions can alter other front-end queries, such as archive or secondary queries. The hook reference demonstrates checking query context before modifying the main query.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
WordPress 2.7 Cookbook
  • Used Book in Good Condition

Understand category IDs and child categories

category__not_in expects an array of category IDs, not category names or slugs. Its documented exclusion does not include child categories. If you also need posts assigned to subcategories excluded, account for those IDs explicitly and test the result; do not assume the parent ID automatically removes its descendants.

The cat query variable also supports negative category IDs for exclusions, including multiple exclusions. It is an alternative documented form, but its behavior should not be treated as identical to category__not_in in every edge case. The WP_Query reference documents both forms.

Use a feed URL or plugin instead of editing PHP

The WordPress.org listing for RSS Control describes controls for feed URLs and examples using category-exclusion query parameters. This is an optional route, not a requirement. Before relying on a plugin, check its current compatibility and confirm how its settings affect the particular feed URLs you use.

A URL-based exclusion can be convenient when you control the feed URL, but it may not provide the same site-wide behavior as changing the main feed query. Confirm the resulting URL and contents with your feed reader or another feed validator rather than assuming the parameter is being applied.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep category-specific feeds working

WordPress provides category feed links. The core link-template.php implementation shows how category feed links are generated. If readers or integrations use a category feed, test its URL after changing the main feed. Verify that the main feed omits the selected posts while the category-specific feed still returns the intended posts.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Do not confuse hiding a label with excluding a post

The the_category_rss hook filters category labels rendered in feed markup. It can change which category names appear alongside an entry, but it does not remove posts assigned to those categories from the feed. To omit posts, change the query; to alter labels only, use the markup filter. The distinction is reflected in the WP_Query reference and WordPress’s feed link-template code.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.