WordPress.org

Forums

the_content_rss filter doesn't work? (5 posts)

  1. Trahald
    Member
    Posted 8 years ago #

    I was trying to make a filter hook that edits the RSS content, but the_content_rss filter doesn't seem to work for me. Here's my test plugin code:

    function test_function($content='')
    {
    	return 'New content';
    }
    
    add_filter('the_content_rss', 'test_function');

    This works fine for the site content if I replace the_content_rss with the_content, and it also works in the RSS feed if I use the_title_rss, but it doesn't work for the_content_rss (note that I am force refreshing with cntrl-f5).

    Anyone have any ideas on what the problem might be?

  2. Trahald
    Member
    Posted 8 years ago #

    Note that I'm using WordPress 2.1.1

  3. Trahald
    Member
    Posted 8 years ago #

    Does anyone know anything about this?

  4. Known issue. If you look at the wp-rss2.php file, you'll find this line:
    <content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>

    It should probably be this instead:
    <content:encoded><![CDATA[<?php the_content_rss() ?>]]></content:encoded>

  5. Chris_K
    Member
    Posted 8 years ago #

    Yeah, my feed plugins start with:

    if ( ! is_feed() ) return $content;

Topic Closed

This topic has been closed to new replies.

About this Topic