From e4c2b25cdb0c07cea02cceebb03822400da688e2 Mon Sep 17 00:00:00 2001 From: Tim LSC Date: Fri, 7 Nov 2025 22:12:34 +0200 Subject: [PATCH] Fix ESI shortcodes in block editor --- src/core.cls.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core.cls.php b/src/core.cls.php index 4aaed6d14..b08ee030c 100644 --- a/src/core.cls.php +++ b/src/core.cls.php @@ -529,6 +529,20 @@ public function send_headers_force( $buffer ) { // Hook to modify buffer after $buffer = apply_filters( 'litespeed_buffer_after', $buffer ); + // Make sure ESI links are decoded in situation where links are changed by block editor, in render function with wptexturize. Ticket #485348. + if ( preg_match_all ( '/()/mU', $buffer, $matches_esi ) ) { + foreach ( $matches_esi[2] as $index => $match ) { + // entity decode needs changes. For example: if finds & %2B %3D + $data = htmlspecialchars_decode($match); + + if ( $data !== $match ) { + $pre_url = $matches_esi[1][$index]; + $post_url = $matches_esi[3][$index]; + $buffer = str_replace( $pre_url . $match . $post_url, $pre_url . $data . $post_url, $buffer ); + } + } + } + Debug2::ended(); return $buffer;