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;