Can't get fragment caching to work?
-
My theme uses a functions to count post views so I am trying to set up this function using fragment caching so it does not get cached and gets updated every time but I cant do so.
I have set it up in following way. Put this code in wp-config:
define( 'W3TC_DYNAMIC_SECURITY', md5( rand( 0, 999999 ) ) );
This is how I called my function:
<!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> --> my_function(get_the_ID()); <!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
I have also set Page Caching mode to Basic as per some guides on web. I am also using Cloudflare minification (CSS, JS, HTML) but to set it up, I disabled HTML minification from Cloudflare and turned it on in W3TC to add ‘mfunc’ in the ‘Ignore Comment Stems’.
However, this setup is not working. Any idea how can I fix this?
- The topic ‘Can't get fragment caching to work?’ is closed to new replies.