Forums

Exclude categories from feeds and archives. (6 posts)

  1. Madcore
    Member
    Posted 5 years ago #

    Hi all.

    I want to exclude some categories of my blog from appear on the feeds of the blog, and on the archives. The reason is simple. I´m using some categories of posts to make an faq section, and links section (instead of internal link system), things that doesn´t catch good into feeds and archives.

    There´s any plugin or method to exclude those categories from the feeds and from the archives?

    Thanks for your time :3.

  2. couppi
    Member
    Posted 5 years ago #

    The only way I know of is to change the feed links to ?feed=rss2&cat=3,4,6 and change the category numbers to the ones you want to include. All other categories would be excluded.

  3. Chris_K
    Member
    Posted 5 years ago #

    To exclude a category from my feed, I have a snippet like this in my theme's functions.php file:

    <?php
    function myFilter($query) {
    if ($query->is_feed) {
    $query->set('cat','-19');
    }

    return $query;
    }

    add_filter('pre_get_posts','myFilter');
    ?>

    Category 19 is the one I don't want in the feed.

  4. moshu
    Member
    Posted 5 years ago #

    This plugin does all of that:
    http://ryowebsite.com/?p=46

  5. Chris_K
    Member
    Posted 5 years ago #

    Ahh... I'd never noticed that plugin handled RSS too.
    Thanks for that.

  6. Madcore
    Member
    Posted 5 years ago #

    Thanks you very much, people ^_^!!

    I got the plugin, and the snipet (I like work with code), and it works.

    YOU´RE NUMBER ONE

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.