/ Published in: PHP
URL: http://www.smashingmagazine.com/2008/12/02/10-useful-rss-hacks-for-wordpress/
Get the numeric ID of the category you want to exclude and edit the functions.php file in your theme. Code explanation. This hack works exactly the same way as the previous one: create a custom function to exclude the category that you don’t want to appear in your RSS feed, and then use the super-useful addfilter() function to apply it to the preget_posts() WordPress core function.
Expand |
Embed | Plain Text
function myFilter($query) { if ($query->is_feed) { $query->set('cat','-5'); //Don't forget to change the category ID =^o^= } return $query; } add_filter('pre_get_posts','myFilter');
You need to login to post a comment.
