moved strip style/script

This commit is contained in:
Matthias Pfefferle 2023-05-23 11:13:17 +02:00
parent 677d507fe9
commit 3d1a0af6cb
2 changed files with 2 additions and 2 deletions

View file

@ -208,6 +208,8 @@ class Shortcodes {
$content = wp_filter_content_tags( $content ); $content = wp_filter_content_tags( $content );
} }
// replace script and style elements
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
$content = strip_shortcodes( $content ); $content = strip_shortcodes( $content );
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) ); $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );

View file

@ -508,8 +508,6 @@ class Post {
$content = do_shortcode( $content ); $content = do_shortcode( $content );
wp_reset_postdata(); wp_reset_postdata();
// replace script and style elements
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
$content = \wp_kses( $content, $this->allowed_tags ); $content = \wp_kses( $content, $this->allowed_tags );
$content = \wpautop( $content ); $content = \wpautop( $content );
$content = \preg_replace( '/[\n\r\t]/', '', $content ); $content = \preg_replace( '/[\n\r\t]/', '', $content );