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

mohammad aghanabi m.websoft at gmail.com
Thu Aug 12 12:38:34 UTC 2010


i didn't used my url as an example, because i did it and i found that it has
a problem
and restored first settings.

but it has problem already when u do it.

On Thu, Aug 12, 2010 at 5:05 PM, Christopher Bratlien <
chrisbratlien at gmail.com> wrote:

> 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
> >
> _______________________________________________
> 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