Litespeed ESI block – how to remove HTML comment?
-
Hi,
I have a form field on my page and need to exclude a
data
attribute on theinput
from caching. Here’s my code so far:On my page:
$exclude = apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block' ); $html = <<<HTML <input id="sc-fbf-reg-tyre-search--size-postcode_{$id}" type="text" class="sc-fbf-reg-tyre-search__form-field tyre-size postcode" data-search_postcode="{$exclude}" disabled /> HTML; echo $html;
In my filters.php:
function my_esi_block_esi_load() { #do_action( 'litespeed_control_set_ttl', 300 ); do_action( 'litespeed_control_set_nocache' ); echo "Hello world".rand (1,99999); } add_action( 'litespeed_esi_load-my_esi_block', '\App\my_esi_block_esi_load' );
The problem I have is that upon viewing the resultant html, I am getting:
<input id="sc-fbf-reg-tyre-search--size-postcode_" type="text" class="sc-fbf-reg-tyre-search__form-field tyre-size postcode" data-search_postcode="Hello world71492<!-- Block uncached by LiteSpeed Cache 5.4 on 2023-09-06 11:40:42 -->" disabled="">
My basic question is how do I remove the HTML comment as obviously it’s not required in this context.
Many thanks
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Litespeed ESI block – how to remove HTML comment?’ is closed to new replies.