I made it without to change the wordpress core: you must to use the same previous idea but with the help of a filter (in this case, a hook that WordPress launches to ‘filter’ the_content_rss).
You just need to add the following code to the functions.php of your WordPress theme:
function notags_content_rss($content='')
{
$content = preg_replace("/\[caption.*\[\/caption\]/", '',$content);
$content = preg_replace("/\[googlevideo.*\[\/googlevideo\]/", '',$content);
return $content;
}
add_filter('the_content_rss', 'notags_content_rss');
Here you can add as many tags to clean as you want.
Hope it can be helpfull.
Brilliant, thanks very much ernestortiz, exactly what I’ve been looking for! 🙂
Guys I’m trying to modify the content of my feed.
Would like to truncate, format & trim the body of each post appearing in the feeds.
I have done the following, in functions.php in my theme folder:
function RSS_headlines($content) {
$content = my_trim_function($content);
return $content;
}
add_filter('the_content_rss','RSS_headlines');
But nothing changes, why is that?
I have tested the code either in a plugin or in functions.php… seems there’s no call to “the_content_rss” neither “the_content” (tried both).
What I’m doing wrong?