• Hi,

    I’m doing a test plugin using “the_content_rss” hook to filter the content of posts, but my function is never called.

    If I use “the_content” or “the_title_rss”, it works. What’s the problem here?.

    This is the code:

    <?php
    /*
    Plugin Name: TestRSS
    Plugin URI:
    Description: Test plugin
    Version: 0.1
    Date: Mar 31th, 2008
    Author: Antonio Perez
    Author URI:
    */
    
    function test_rss($text)
    {
    	$text = "Hello world";
    	return $text;
    }
    
    add_filter('the_content_rss', 'test_rss');
    ?>

    Thanks in advance for your answer.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am having the same problem.

    A workaround would be to use ‘the_content’ filter and is_feed() conditional tag, but it gets annoying to know that you could use a hook, if it was functioning.

    Submitted ticket 6847.

    hi, I just submitted a patch on that ticket which uses is_feed() inside the_content() function to run the the_content_rss hook when appropiate. The issue is appearently the rss2 and atom feeds go through the_content() instead of the_content_rss(). Anyway patch needs testing.

    Thread Starter skarcha

    (@skarcha)

    It works now!. Thanks mystyman.

    That ticket (6847) has been closed as “invalid”, but I don’t understand why–I suspect that the person who closed it didn’t realize that it doesn’t seem to work with Atom or RSS2 because of https://core.trac.www.ads-software.com/ticket/8706.
    The patch that mystyman suggested works because of the inconsistency in 8706; the person who marked 6847 invalid is correct about how it /should/ work, but not about how it currently /does/ work, and until 6847 is fixed mystyman’s patch looks like the right answer to me.

    Also, here’s another forum thread on it:
    https://www.ads-software.com/support/topic/192997.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem with “the_content_rss” hook’ is closed to new replies.