improving the_content_rss() in treating [caption] tag.
[caption] tag from RSS result.
I have '
the_content_rss'',TRUE,'',20)' command inside the Loop.
The result is here.
In that picture, you can see [caption id="" align="......] is included on RSS format. This is not a perfect view of my theme then.
the_content_rss() should hide [caption]<img.../>[/caption] from the RSS. So there is not any ugly text since most RSS reader are considered as accept text only.
This happened for all tags with
[audo:song.mp3] as used by 1pixelout audio player plugin.
So I had the same problem. And here is what I've done.
In file wp-includes/feed.php I've placed this string:
$content = apply_filters('the_content_rss', $content); /* already was there, here is for navigation. it's near 164 line */
$content = preg_replace("/\[caption.*\[\/caption\]/", '', $content); /* string itself */
if ( $cut && !$encode_html ) /* next line, for navigation too */
And it's worked. But only for [caption]. I'm not pro in regexps, so you can play with it for better results.
I was using a theme that pulled the RSS feed of each post and presented it as an excerpt on the front page along with whatever image the post had.
The [caption] crap was stuck in there until I used your fix and voila!
Thanks for putting this little fix togther!
@Norton, thanks for the fix. It worked!!
I'm fairly certain this no longer occurs, as shortcodes appear to be parsed in the feeds now.
RSS feed for this topic
This topic has been closed to new replies.