WordPress.org

Support

Support » How-To and Troubleshooting » Omitting categories from an RSS feed

Omitting categories from an RSS feed

  • 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,

Viewing 3 replies - 1 through 3 (of 3 total)
  • This plugin, if it works with your version, has that feature: you can exclude a cat from the feeds.

    RYO ‘Category Visibility’ WordPress Plugin

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

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Omitting categories from an RSS feed’ is closed to new replies.