From 3d1a0af6cb131045e94b776e2099ad6a5d2b8a8d Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 23 May 2023 11:13:17 +0200 Subject: [PATCH] moved strip style/script --- includes/class-shortcodes.php | 2 ++ includes/model/class-post.php | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index 7a0dd64..5387387 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -208,6 +208,8 @@ class Shortcodes { $content = wp_filter_content_tags( $content ); } + // replace script and style elements + $content = \preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $content ); $content = strip_shortcodes( $content ); $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) ); diff --git a/includes/model/class-post.php b/includes/model/class-post.php index 0c36f58..9d58068 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -508,8 +508,6 @@ class Post { $content = do_shortcode( $content ); wp_reset_postdata(); - // replace script and style elements - $content = \preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $content ); $content = \wp_kses( $content, $this->allowed_tags ); $content = \wpautop( $content ); $content = \preg_replace( '/[\n\r\t]/', '', $content );