Support » Fixing WordPress » Strip Shortcodes

  • Hello
    I’m having just a little problem with my wordpress theme. When I make a post, the preview text is displayed containing the [caption] shortcode. I’d really like to remove this. I know you can use <?php strip_shortcodes( $content ); ?> to remove shortcodes, but I’m very bad at Php and can’t get it to work in my theme.

    My theme contains this:

    # Removes tags and trailing dots from excerpt
    function dp_clean($excerpt, $substr=0) {
    	$string = strip_tags(str_replace('[...]', '...', $excerpt));
    	if ($substr>0) {
    		$string = substr($string, 0, $substr);
    	}
    	return $string;
    }

    I’m not sure how any of it works, but I need to include strip_shortcodes() in this function(I think).

    Any help is appreciated. Thank You!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Strip Shortcodes’ is closed to new replies.