Forums

Modifing RSS feed to filter one category (3 posts)

  1. supergab
    Member
    Posted 4 years ago #

    I would like my feed

    http://www.blogurl.com/feed

    to permanently become

    http://www.blogurl.com/feed?cat=-55

    I don't want category 55 to show up in feed. How can I modify this in feed-rss2.php ?

  2. ruibo
    Member
    Posted 4 years ago #

    I'm actually looking for the same fix, any help would be appreciated. Been searching forever and nothing.

  3. swedish boy
    Member
    Posted 3 years ago #

    you shouldn't modify feed-rss2.php.
    but if you really want to then add the following before the loop (add a row after row 33)

    <?php query_posts('cat=-55'); ?>

    but better up (to still be there after updates of wordpress)
    add this to your functions.php inside your theme.

    function fix_feed_link($args) {
    	return $args.'?cat=-55'; // add any valid feed args
    }
    add_filter('post_comments_feed_link', 'fix_feed_link',10,1);

    this filters every call to the main feed or comment feed to not include category 55.

    works for me!
    some documentation on valid arguments to pass can be found here:
    http://codex.wordpress.org/WordPress_Feeds

Topic Closed

This topic has been closed to new replies.

About this Topic