elegant themes

Exclude Categories from Feed, Archives, Search, and Home page in WordPress

| January 14, 2010 | 3 Comments

We often find ourselves looking for the best and easiest way to exclude categories or pages from the navigation menu, the WordPress loop, the category list, the feed, the search, and/or the archive. It’s so easy to forget one of these elements and accidentally let that category slip into the blogstream. We actually wrote about a few WordPress plugins that exclude categories two years ago, but it’s definitely time to revisit this issue.

Recently, Miriam found an AMAZING plugin, Simply Exclude by Paul Menard, which is basically excluding heaven… if there is such a thing.

Exclude categories WordPress

Advanced Category Excluder vs. Simply Exclude

You may have come across the Advanced Category Excluder plugin, and wonder why we didn’t use that one. Here’s why:

Advanced Category Excluder (ACE) vs.  Simply Exclude:

  • Advanced Category Excluder conflicts with the Exclude Pages plugin (described below) which excludes pages  from the nav bar. Simple Exclude does not. When I activated it ACE all the pages that had been excluded with the Exclude Pages plugin appeared on the nav bar.
  • ACE also offers you to exclude Pages, which is so annoying since you have to go through a long list of all the pages on your site to see which you want to exclude, and they appear in long lists without any indication of parent pages and sub-pages. Also, there’s no easy way to exclude pages when you are adding or editing a page.
  • With ACE you have to first publish a post in a category, and only then will that category appear in the list of categories for exclusion. This means that if you want a category to not appear in the RSS feed etc., your first post in that category has to.

How to manually exclude categories in the theme files

And here are a few tips on how to exclude categories manually from the feed and the loop if you still prefer some good ol’ fashioned manual labor.

How to Manually Exclude a Category from a RSS feed

Place the following code in your functions.php file replacing 12 with your category and commas for additional categories. Tip from Web Kreation.

function myFeedExcluder($query) {

if ($query->is_feed) {



return $query;



How to Manually Exclude a Category in Feedburner

Under Edit Feed Details add a ?cat=-93 or whatever the category ID number is so it comes out like:  http://domain.com/feed?cat=-93

How to Manually Exclude a Category from the Loop

Add this code BEFORE the loop and change 52 to whatever category you want to exclude

<?php query_posts(‘showposts=2&cat=-52′); ?>

Bonus: Easily Exclude Pages

Since we’re discussing excluding stuff from your WordPress blog, here’s a related plugin that we love called Exclude Pages by Simon Wheatley. It’s easy to use and great to give clients for excluding pages from their navigation menu. Exclude Pages adds a checkbox on the edit Page page that users can click to select to exclude the Page they are working on from any place that lists all Pages, like the navigation bar.


Category: Plugins

About Rebecca Markowitz: Rebecca Markowitz has built over 50 WordPress sites for clients as Web Project Manager and WordPress specialist at illuminea. illuminea is a Jerusalem-based boutique web agency. WPGarage shows my dedicated relationship with WordPress over the years - full of love, laughs, tears, growth and strong drinks. L'chaim! View author profile.

Comments (3)

Trackback URL | Comments RSS Feed

  1. carrie says:

    can i use your code but change it to something that will block display of $thumbnail if $query is_feed?

  2. Piet says:

    I would like to know the same as @carrie: how to exclude thumbnail (or all images for that matter) from showing in the feed?
    I have tried many different ways of the query below, but none has the desired effect. Any suggestions would be very welcome!

    if ($query->is_feed) {
    $query->set(‘post_image’, ‘0’);

  3. Adal says:

    I would like to comment on your criticism of ACE, because I think it needs to be updated.

    ACE DOES allow to display empty categories in the list of categories to exclude: it’s an option you check in the first settings page.
    ACE already allows for page exclusion, so the conflict with another plugin that offers the same functionality is not so relevant. Plus you should be using WP 3.0 menus if the site is getting big.

    Also Simply Exclude is nice and lite, but does NOT offer anything near the functionality of ACE, for starters excluding things from sidebar widgets.

    I don’t have any vested interest with the creators of ACE, but since your post is doing very well on Google, I wanted to share my thoughts on it.

    Sorry for the harsh tone, fact is I enjoy the debate your post creates!

Leave a Reply

If you want a picture to show with your comment, go get a Gravatar.

More in Plugins (17 of 116 articles)