Wordpress LScache Plugin: Can use ESI and short code like this somexxx/some ???
I have a shortcode to hide content from user defined. Can use ESI and short code like this [some]xxx[/some] ??? Tks! Hi, officially no , but you could try , in some case it works best regards, Hi, I have a piece of PHP code that needs to be removed from the cache, I have seen the instructions here: https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url The test code works fine, however when I replace it with my php code it has problems printing them out. How can I remove this code from cache using ESI? Here is my code snippet: echo apply_filters(the_content, $post->post_content) elseif ($this_chapter[lock] == 0) $BF = [hide-content type=show ] $AT = [/hide-content] echo apply_filters(the_content, $BF . $post->post_content . $AT) ?> Tks! what problem on the print them out ? but I doubt if you can render the shortcode within ESI block like this you should probably better to do the output directly within ESI of what that shortcode does Heres a snippet of code that handles the path: /wp-content/themes/xxx/yyy/example.php Can I exclude this file from cache to always execute the PHP code in here? no , cache is per page basis , not per file ? the final output HTML source code to browser, that is considered as a page and is what to be cached My code snippet is meant to check the condition and output different post content for each membership level. When using ESI, the code does not output the article content. I dont know where I am going wrong. Can you help me write a statement that prints the php code in do_action( litespeed_control_set_nocache ) are not? This is php code echo apply_filters(the_content, $post->post_content) elseif ($this_chapter[lock] == 0) $BF = [hide-content type=show ] $AT = [/hide-content] echo apply_filters(the_content, $BF . $post->post_content . $AT) ?> Hi, yes, because the ESI subrequest is not exactly as normal request to wordpress , some env may not be loaded so you probably wont be able to do apply_filter(content you may need to directly retrieve the post content from the database , instead of using apply_filter perhaps you should consider use ajax call or private page cache to this goal Best regards,