[wp-hackers] Check If I'm in a Feed?

Computer Guru computerguru at neosmart.net
Fri Mar 23 08:37:36 GMT 2007


Sorry, it *does* work, but there is another problem.

Like my original code, is_feed() evaluates as true if the word "feed"
appears in the permalink. :(

So now I use is_feed() && !is_single() && !is_home() && !is_page()

Computer Guru
NeoSmart Technologies
http://neosmart.net/blog/


> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
> bounces at lists.automattic.com] On Behalf Of Kimmo Suominen
> Sent: Friday, March 23, 2007 9:28 AM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Check If I'm in a Feed?
> 
> What if you add the filter unconditionally and use is_feed()
> in the filter function?  That should be late enough that
> is_feed() already knows to return the right value.
> 
> Best regards,
> + Kimmo
> --
> <A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>
> 
> On Fri, Mar 23, 2007 at 09:23:48AM +0200, Computer Guru wrote:
> > It's not working.
> >
> > /*********************************************************
> > if ( stristr( $_SERVER['REQUEST_URI'], 'feed' ) != FALSE )
> > 	add_filter( 'the_content','NST_CheckRSS' );
> > *********************************************************/
> >
> > /*********************************************************
> > if ( is_feed() )
> > 	add_filter( 'the_content','NST_CheckRSS' );
> > *********************************************************/
> >
> > The first code sample - the old code - works just fine. The new code
> > doesn't.
> >
> > Requests made to http://server/wordpress/?feed=rss2 _aren't_ kicking
> off
> > is_feed()
> > Nor requests to http://server/wordpress/feed/ or anything else for
> that
> > matter.
> >
> > Tested on WP 2.1 Branch and WP Trunk.
> _______________________________________________
> 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