[wp-hackers] Excluding a category posts from feed and a little question

mohammad aghanabi m.websoft at gmail.com
Thu Aug 12 09:54:28 UTC 2010


hi;
i recently used this short code in functions.php to exclude a category posts
( id=20 ) from being shown in wordpress feed.
<?php
function my_cat_exclude($query) {
    if ($query->is_feed) {
        $query->set('cat','-20');
    }
    return $query;
}
add_filter('pre_get_posts','my_cat_exclude');
?>
but the problem is, this function interrupts other wordpress categories
feeds and they won't show their posts. ( just displaying the main
url feed content )

- for example this feed content : http://www.mysite.com/?feed=rss2&cat=21
is like this content : http://www.websoftdownload.com/?feed=rss2
by using that function and also the plugins that i tested were the same.

SOS !


More information about the wp-hackers mailing list