Title: Litespeed Cache Issue
Last modified: August 12, 2022

---

# Litespeed Cache Issue

 *  Resolved [greencode](https://wordpress.org/support/users/greencode/)
 * (@greencode)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/)
 * I have LiteSpeed Cache installed but with that installed and I use
 * `<?php echo 'Views '.wpp_get_views( $post->ID ); ?>`
 * on single posts to get a live view of the number of views. However, it doesn’t
   update due to the caching and only updates once the cache expires (every 24 hours).
 * I have the following in the ESI Nonce list of LiteSpeed which should then exclude
   these from caching
 *     ```
       stats_nonce
       subscribe_nonce
       wp_rest
       wpp-*
       wpp_*
       ```
   
 * But that doesn’t work.
 * Any ideas or help would be very much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/#post-15911510)
 * Hi [@greencode](https://wordpress.org/support/users/greencode/),
 * The real issue here is that your code is rendering text on page (the views count),
   and said text is being cached along with the entire page by LiteSpeed’s page 
   cache 😛
 * If you want to prevent LiteSpeed (or any other page caching solution) from caching
   specific content, in this case your page/post views count, you’ll need to use
   [AJAX](https://developer.wordpress.org/plugins/javascript/ajax/) to load said
   content dynamically.
 *  Thread Starter [greencode](https://wordpress.org/support/users/greencode/)
 * (@greencode)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/#post-15911531)
 * Thanks for replying. I do have the “Ajaxify widget” setting enabled which I thought
   may resolve the issue. It didn’t.
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/#post-15911542)
 * It won’t because “Ajaxify widget” only applies to the WordPress Popular Posts
   widget / block. Hence the “Ajaxify widget” text.
 * You’ll need to implement your own AJAX function to prevent LiteSpeed from caching
   your views count on single.php. Have a look at the link I shared above, it should
   get you on the right track.
 *  Thread Starter [greencode](https://wordpress.org/support/users/greencode/)
 * (@greencode)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/#post-15911566)
 * Thanks for this. A little beyond my developing knowledge so will have to look
   around for another solution.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Litespeed Cache Issue’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [caching](https://wordpress.org/support/topic-tag/caching/)

 * 4 replies
 * 2 participants
 * Last reply from: [greencode](https://wordpress.org/support/users/greencode/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/litespeed-cache-issue-2/#post-15911566)
 * Status: resolved