[wp-hackers] Hide category

Paul paul at codehooligans.com
Mon Dec 1 23:07:39 GMT 2008


Dan,

I wrote a little plugin to exclude categories from standard WP  
functions like is_feed, is_front, is_search, etc.
http://wordpress.org/extend/plugins/simply-exclude/

If you don't want to use the plugin you can setup a simple function in  
your theme's functions.php file

// Used to limit the categories displayed in the Feed.
function myHomePostsFilter($query)
{
	if ($query->is_feed)
	$query->set('cat','-1'); // where -1 is the cat ID you want to  
exclude. Also you can put multiple IDs in this second parameter. You  
must include the '-' to negate the cat ID.
	
	return $query;
}
add_filter('pre_get_posts','myHomePostsFilter');

P-

On Dec 1, 2008, at 4:40 PM, Dan Gayle wrote:

> We have a custom XML feed coming off of our blog that feeds into  
> Google News, and the method used to select the items to send in the  
> feed is by category, "Google News Feed" .
>
> How can we hide the fact that our posts are in that category,  
> without messing up the regular functionality of the post?
> _______________________________________________
> 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