Skip to content

Commit 8730661

Browse files
committed
strip style and script elements
1 parent e2c1dc2 commit 8730661

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

includes/class-shortcodes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public static function excerpt( $atts, $content, $tag ) {
106106

107107
// An empty string will make wp_trim_excerpt do stuff we do not want.
108108
if ( '' !== $content ) {
109-
110109
$excerpt = \strip_shortcodes( $content );
111110

112111
/** This filter is documented in wp-includes/post-template.php */
@@ -199,6 +198,9 @@ public static function content( $atts, $content, $tag ) {
199198

200199
$content = \get_post_field( 'post_content', $post );
201200

201+
// replace script and style elements
202+
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
203+
202204
if ( 'yes' === $atts['apply_filters'] ) {
203205
$content = \apply_filters( 'the_content', $content );
204206
} else {

0 commit comments

Comments
 (0)