WordPress.org

Ready to get started?Download WordPress

Ideas

improving the_content_rss() in treating [caption] tag.

  1. kardjo
    Member

    Hiding [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.

    IMO, 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.

    regards

    Posted: 5 years ago #
  2. kardjo
    Member

    [addition]
    cmiiw
    This happened for all tags with [ (square-bracket) ].
    Like [audo:song.mp3] as used by 1pixelout audio player plugin.

    Posted: 5 years ago #
  3. Norton
    Member

    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.

    Posted: 5 years ago #
  4. ubrayj02
    Member

    12345

    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!

    Posted: 5 years ago #
  5. dmouth
    Member

    @Norton, thanks for the fix. It worked!!

    Posted: 4 years ago #
  6. Ryan McCue
    Member

    I'm fairly certain this no longer occurs, as shortcodes appear to be parsed in the feeds now.

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    3 Votes
  • Status

    This idea has been implemented