Forums

is_feed() or $doing_rss - What is the difference? (2 posts)

  1. oodi
    Member
    Posted 4 years ago #

    I am writing a plugin that modifies the_content in a way which is unsuitable for feeds. I figured out that I can use the is_feed() function or the $doing_rss global var to determine something about feeds. Question is, what does each do?

    If I access my site they both return false, if I access example.com/?feed=rss or example.com/?feed=rss2 they both return '1'. If I access example.com/wp-feed.php is_feed() returns false but $doing_rss = '1'.

    So what do I use to identify that the_content is going to a feed?

    Thanks,
    Adi

  2. alphaoide
    Member
    Posted 4 years ago #

    At glancing the code, it seem that there are two entry points to feed content. Anyway, just check for either condition.

    if (is_feed() || $doing_rss) {
    ...
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.