Title: Disable Caching Specific .PHP File
Last modified: May 27, 2023

---

# Disable Caching Specific .PHP File

 *  Resolved [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/)
 * Hello. I have a PHP file named time.php which gives me the current time. The 
   issue is the time remains the same all the time. It only changes when I clear
   the cache but doesn’t change to the correct time when I reload the page. I’ve
   done multiple search but no solution yet.

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

 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16773613)
 * you may need to convert it to ESI block
 * please check this[ page](https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url)
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16774990)
 * Hello. I went through that page but I’m confused. It seems complicated.
 * Here is my code below:
 * date_default_timezone_set(‘Africa/Lagos’);
   $date = date(‘M d, Y, H:i’);echo $
   date.’ WAT.’;
 * Please help.
    -  This reply was modified 3 years ago by [electriztown](https://wordpress.org/support/users/electriztown/).
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16775348)
 * in example , you can just replace the part
 * `echo "Hello world".rand (1,99999);`
 * to your code
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16775411)
 * Hello, there are other random stuffs in the codes on the page you shared with
   me. Should I leave them the same?
 * Maybe you can give me the code to use with my code. Please…
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16775413)
 * you can remove the other stuffs in it
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16775477)
 * I’ve tried but still not working. Perhaps you can please modify the code for 
   me with my code.
 * Here’s my code:
 * date_default_timezone_set(‘Africa/Lagos’); echo date(‘M d, Y, H:i’).’ WAT.’;
 * Please…
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16775480)
 * Main code.php
 * $my_var = “test var”;
   $my_var2 = “test var 2”;add_action( ‘litespeed_esi_load-
   my_esi_block’, function() use ($my_var, $my_var2) {do_action( ‘litespeed_control_set_nocache’);
   echo “Hello world”.rand (1,99999);echo ‘my var:’ . $my_var . $my_var2;});
 * Functions.php
 * add_action( ‘litespeed_esi_load-my_esi_block’, ‘my_esi_block_esi_load’);
 * function my_esi_block_esi_load($params)
   {do_action( ‘litespeed_control_set_nocache’);
   echo “Hello world”.rand (1,99999);echo var_dump($params);}
 * Please see what I’m talking about.
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16778011)
 *     ```wp-block-code
       add_action( 'litespeed_esi_load-my_esi_block', 'my_esi_block_esi_load' );
   
       function my_esi_block_esi_load()
       {
       do_action( 'litespeed_control_set_nocache' );
       date_default_timezone_set('Africa/Lagos');
       $date = date('M d, Y, H:i');
       echo $date. ' WAT.';
       }
       ```
   
 * and
 *     ```wp-block-code
       echo apply_filters( 'litespeed_esi_url', 'my_esi_block', 'Custom ESI block' );
       ```
   
 * where you want to display it
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16778894)
 * Thank you for your efforts.
 * Did you test this to see if it’ll work? It messed up my page and it’s not working
   at all from my end.
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16779173)
 * yes , it works on my test , did you enable ESI ? and are you using LiteSpeed 
   Enterprise ?
 * please provide the report number , you can get it in toolbox -> report -> click“
   send to LiteSpeed”
 * and by mess up , how exactly ? any more specific symptom and behavior ?
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16783110)
 * Thank you for pointing out enabling ESI. I just did now and it’s working fine.
 * What if I want to have multiple ESI blocks for different items? Please how do
   I go about it?
 * Lastly, please I have one more issue. My comment reply doesn’t work. For example,
   when someone clicks on REPLY in a comment, the reply form doesn’t show up. This
   issue started as a result of caching. Please help…
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16783341)
 * Update: My theme doesn’t work properly when ESI is enabled; I can’t edit my pages
   and post and cannot navigate the theme. I use Pro by Theme.co
 * How can I upload screenshot here so you can see.
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16784580)
 * for comment , if you use default setting, does it work ?
 * and how exactly you can not edit page/post ? it should not affect things in wp-
   admin area.
 *  Thread Starter [electriztown](https://wordpress.org/support/users/electriztown/)
 * (@electriztown)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16784851)
 * I mean, Cornerstone which is Themeco’s Page Builder doesn’t work when ESI is 
   enabled. I searched on this support and found out that someone had similar complain
   over a year and half ago but he doesn’t seem to have found any solution yet. 
   I’d appreciate if you can get a solution to solve this issue.
 * Please what do you mean by default settings for the comments?
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16787761)
 * what exactly is the issue with cornerstone ?
 * by default I meant if you use default setting , without enable any option , how
   does comment do ?

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

The topic ‘Disable Caching Specific .PHP File’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [esi](https://wordpress.org/support/topic-tag/esi/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 15 replies
 * 2 participants
 * Last reply from: [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/disable-caching-specific-php-file/#post-16787761)
 * Status: resolved