Wordpress LScache Plugin: Wp-post views and litespeed
Last Updated on: Wed, 15 Apr 2026 00:00:02 When I activate the Wp-Postviews plugin, the plugin is cached and the number of views of other content is not counted and the cache mode remains. How can I fix this problem if it has its own content count? Hi, was that added as widget ? if that so , you can enable ESI , and make it ESI block e.g. , change [shortcode] to [esi shortcode ttl=0 ] otherwise you will need to use a cache-compatible post view counter plugin , that can retrieve number by ajax call or REST API Best regards, You see, I do not use the plugin, but I use the following code to display the views of each article, but as soon as the litespeed plugin is activated, the counting will fail xxxxx : xxxx Hi, you need to wrap it as ESI block , more detail in this page https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url example code from this function https://wordpress.stackexchange.com/questions/144340/how-to-display-post-view-count function getPostViews($postID) $count_key = post_views_count $count = get_post_meta($postID, $count_key, true) if($count==) delete_post_meta($postID, $count_key) add_post_meta($postID, $count_key, 0) return 0 View return $count. Views // function to count views. function setPostViews($postID) $count_key = post_views_count $count = get_post_meta($postID, $count_key, true) if($count==) $count = 0 delete_post_meta($postID, $count_key) add_post_meta($postID, $count_key, 0) else $count++ update_post_meta($postID, $count_key, $count) add_action( litespeed_esi_load-postview_esi_block, postview_esi_block_esi_load ) function postview_esi_block_esi_load() do_action( litespeed_control_set_nocache ) setPostViews(get_the_ID()) echo getPostViews(get_the_ID()) Expand above code will make get view and set view to be ESI block , with no-cache parameter , so each time access to a cached page, it will give one more view , and retrieve view counter in real status , then echo it out where you added your above code. Best regards, Hi, Im going to mark this topic Resolved , due to lack of activity. If you still need help, please feel free to re-open it. When re-open it, please also change the topic status to not solved Best regards,
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference