how to prevent post update time and DL count from caching Litespeed

Question

in my site, I have some sections like post update time and DL count.
these sections must return real value.
for them, I used from ESI block by PHP code.

add below code in my function.php file:

add_action('litespeed_esi_load-esi_last_update', 'esi_last_update_esi_load');
function esi_last_update_esi_load($params)
{
do_action('litespeed_control_set_nocache');
echo dw_time_ago('j F Y');
}

and replace below code instead of post update time:

echo apply_filters( 'litespeed_esi_url', 'esi_last_update', 'esi last update' );

but in my index page, there are many the posts that they have update post time and the posts loaded with slow speed and one by one

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-prevent-post-update-time-and-dl-count-from-caching-litespeed/">

how to prevent post update time and DL count from caching Litespeed</a>
0
, hossein naghneh 4 weeks 0 Answers 24 views 0

Leave an answer