[wp-hackers] Excluding a category posts from feed and a little question
Christopher Bratlien
chrisbratlien at gmail.com
Thu Aug 12 12:35:38 UTC 2010
When I visit feed://www.websoftdownload.com/?feed=rss2&cat=21 the feed
contains a different set of posts than if I visit feed://
www.websoftdownload.com/?feed=rss2&cat=20 or feed://
www.websoftdownload.com/?feed=rss2
Did you already find a solution to your problem?
Your code seems valid to me. I've used a similar method to exclude posts
from RSS feeds before.
On Thu, Aug 12, 2010 at 4:54 AM, mohammad aghanabi <m.websoft at gmail.com>wrote:
> 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 !
> _______________________________________________
> 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