• Anyone know how to strip the caption shortcode from the_content_rss output? HTML markup for the img itself gets stripped, but the caption shortcode remains…

    I have tried strip_shortcode, remove_shortcode, remove_all_shortcode but to no avail.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am also in need for a solution to this problem. I have an XML-file a partner needs to use, but I can’t seem to get rid of the [caption]-part of posts with images in them.

    Does this require some preg_replace or something? If so, can anyone point me in the direction of a solution?

    this was posted somewhere else:

    add to the feed.php file

    $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 */

    I’m having the same problem. And I’d like to try the code given above too, but only thing is I can’t find a feed.php. Help anyone?

    @craybradfield Thanks for the Regex solution you posted it works a treat.

    I had to use the Regex after I found the the WP Codex function strip_shortcodes function leaves the closing shortcode tag for some unknown reason [/caption]

    Has anyone else come across this and perhaps have a theory as why this is happening?

    @kestrel_id: I confirmed this, I have to do a str_replace(“[/caption]“, ”, $content) to get rid of this. This could be a bug. Can someone confirm?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove Caption Shortcode from the_content_rss … ?’ is closed to new replies.