WordPress.org

Ready to get started?Download WordPress

Forums

Omitting categories from an RSS feed (4 posts)

  1. Ryan
    Member
    Posted 7 years ago #

    Is there a way to create a feed that does not include posts from a certain category? What I'm trying to do is set up two feeds, one with critical notices and one with everything else. The critical is easy, it's just /category/feed/. But the everything else feed would include the critical category as well and I don't want it to.

    Thanks,

  2. moshu
    Member
    Posted 7 years ago #

    This plugin, if it works with your version, has that feature: you can exclude a cat from the feeds.
    http://ryowebsite.com/wp-plugins/category-visibility/

  3. Chris_K
    Member
    Posted 7 years ago #

    A technique I've used in the past can be found at
    http://zeo.unic.net.my/notes/exclude-category-in-wordpress/

  4. sparkletack
    Member
    Posted 6 years ago #

    HandySolo: I'm trying to use the Zeo technique mentioned above, but my theme did not come with a functions.php file.

    I created one:

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

    Unfortunately, it is having the effect of breaking the WP post editor! When I try to save a post, a page of errors results as follows:

    Warning: Cannot modify header information - headers already sent by (output started at /home/.goomba/calyxdesign/calyxdesign.com/wp-content/themes/modern/functions.php:15) in /home/.goomba/calyxdesign/calyxdesign.com/wp-includes/pluggable.php on line 390

    I don't even know if it's working on the RSS feed, because I can't create a post to test it.

    Any idea as to what's happening here?

Topic Closed

This topic has been closed to new replies.

About this Topic