Forums

[resolved] Difference Between Filter Hooks: the_content vs. the_content_rss (2 posts)

  1. saphod
    Member
    Posted 1 year ago #

    Hi,

    I am trying to understand the difference between the filter hooks the_content and the_content_rss.

    I just recently modified a plugin that embeds videos so that a different embed code and/or text is used when the post is viewed as RSS (e.g. "There is a video embedded here. Please visit the original post to view it.").

    I have applied the function to the_content as well as to the_content_rss. Within the function, I try to distinguish between "normal" post and feed with is_feed().

    Works fine.

    I have a question, tough:

    Is everything that is applied to the_content also automatically applied/passed on to the_content_rss, or are both filters handled separately? In other words: if I check for a feed via is_feed() in a function applied to the_content, do I still need to apply the function to the_content_rss? Or is the last one just another chance to add special information that shall not be seen in the post (like a copyright), but it already has the changed content of the post?

    Example (for a better understanding): Imagine I apply a function that changes "and" to "or" within the_content.

    Before: The Dog is grey and the cat is black.
    After: The Dog is grey or the cat is black.

    If I do not apply that function to the_content_rss, will it read the "and" or the "or" within the feed???

    So, the main question is:
    Do I really need the_content_rss for the modified plugin?

    Thanks!

  2. saphod
    Member
    Posted 11 months ago #

    As I just found out on phpxref.com, there is a loop-function called the_content_rss where the filter is defined, so I guess this filter hook does only work if that special function is used... kind of makes sense to me.

Topic Closed

This topic has been closed to new replies.

About this Topic