Chris Roberts
Member
Posted 5 years ago #
I've got a plugin that works on the_content of a post. I'm wanting to come up with a way to tell whether or not the_content is being generated for display in an RSS reader so I can prevent the plugin from doing some things it would do in a browser. Is there a good way to tell whether or not the post is being generated for the feed?
Thanks,
Chris
Look at the source code of the feed output?
I have not tested it, but I think you should be able to do:
function your_function()
{
global $doing_rss;
if ($doing_rss == 1)
// we're doing RSS
else
// we're not
...
Now, this does assume that you're giving people the correct feed links. example.com/blog/feed, example.com/blog/feed/atom and so forth..
Chris Roberts
Member
Posted 5 years ago #
Otto,
That sounds along the line of what I'm looking for. Thanks.