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

Kimmo Suominen kimmo+key+wordpress.c4f53f at suominen.com
Fri Mar 23 07:27:59 GMT 2007


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.


More information about the wp-hackers mailing list