mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-23 23:04:25 +00:00
Strip shortcodes when making excerpts. Props hailin. fixes #7100
git-svn-id: https://develop.svn.wordpress.org/trunk@8054 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -134,6 +134,23 @@ function shortcode_atts($pairs, $atts) {
|
||||
return $out;
|
||||
}
|
||||
|
||||
/*
|
||||
* stip all the shortcodes from a post's content
|
||||
* returns the content without shortcodes
|
||||
*/
|
||||
function strip_shortcodes( $content ) {
|
||||
|
||||
global $shortcode_tags;
|
||||
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags))
|
||||
return $content;
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
|
||||
return preg_replace('/'.$pattern.'/s', '', $content);
|
||||
|
||||
}
|
||||
|
||||
add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user