diff --git a/src/core.cls.php b/src/core.cls.php index bd40ff0ff..1782c81e2 100644 --- a/src/core.cls.php +++ b/src/core.cls.php @@ -539,6 +539,21 @@ 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, $matchesEsi)){ + foreach($matchesEsi[2] as $index => $match){ + $data = $match; + + // entity decode needs changes. For example: if finds & %2B %3D + $data = parse_str($data); + + if($data !== $match){ + $pre_url = $matchesEsi[1][$index]; + $post_url = $matchesEsi[3][$index]; + $buffer = str_replace($pre_url.$match.$post_url, $pre_url.$data.$post_url, $buffer); + } + } + } Debug2::ended(); return $buffer;