Exclude category from RSS feed in wordpress

January 22, 2010 | Filed Under Wordpress | 3 Comments

To exclude category in wordpress rss feed.

you can simple write.

<a href="<?php bloginfo('url');  ?>/feed?cat=-1&cat=-2">(RSS)</a>

or   you can simple write below code in your theme function.php
to   exclude category categories.


function excludeCat($query) {
 if ($query->is_feed) {
 $query->set('cat','-1');// for   multiple use with , eg-  -1,-2,-3
 }
return $query;
 }
add_filter('pre_get_posts','excludeCat');

Comments

3 Responses to “Exclude category from RSS feed in wordpress”

  1. You have tested it and writing form your personal experience or you find some information online?

  2. admin

    Yes i have tested it.

  3. I would appreciate more visual materials, to make your blog more attractive, but your writing style really compensates it. But there is always place for improvement

© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker