[wp-hackers] SELECT SQL_CALC_FOUND_ROWS distinct wp_posts query

Paul paul at codehooligans.com
Sat Oct 17 14:57:00 UTC 2009


Not to comment on the plugin author's work. But to exclude categories  
from the RSS feed is quite simple and can be accomplished using build- 
in WP hooks and not any query manipulation needed. Consider the simple  
function below.

In this I want to exclude categories 1, 32, 16 and 28 from the main  
RSS feed. Drop this into your theme's functions.php and tweak the  
category IDs.

function myRSSPostsFilter($query) {
	if ($query->is_feed) {
		$query->set('cat','-1,-32,-16,-28');
	}
	return $query;
}
add_filter('pre_get_posts','myRSSPostsFilter');


Or you can use my Simply Exclude plugin http://wordpress.org/extend/plugins/simply-exclude/ 
  to have a nice user interface so you don't have to touch the code.  
The code uses the same basic principal as the function above. I wrote  
a similar plugin that allow exclude of categories, tags and authors  
from is_front, is_archive, is_search and is_feed actions.

Best,

Paul


On Oct 17, 2009, at 9:10 AM, Jeremi Bergman wrote:

> Yes, it excludes certain categories from the RSS feed, among other  
> things,
> which is what we're looking for?
>
> Is there an alternative to excluding categories from the rss feeds?
>
> -- 
> Jeremi Bergman
> 865-622-7134
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list