• We’re attempting to setup fragment caching on our site. I’ve been reading all the threads in the forums about it and found some nuggets of wisdom not explained anywhere. (BTW, can anyone point me to the W3TC developer page on fragment caching? I can’t seem to find the docs for it…)

    While reading all of these posts, I ran across something the developer said in this support thread:

    Code within mfunc does not know anything outside of the mfunc tags. So it can’t call any functions, set variables etc in the template files themselves outside of the mfunc tags.

    You can only call functions defined in plugins and also WP functions if you enable late init.

    Can someone clarify if that means I can’t use custom functions defined within the specific template using the mfunc comments, or does that mean that I can use custom functions defined elsewhere, such as in functions.php, because they are not in the same template file using the mfunc comments. Does this make sense?

    So to elaborate, our setup is as follows…

    I have the constant set in wp-config:

    define('W3TC_DYNAMIC_SECURITY', 'FRAGMENT_CACHING');

    I have my code in the template:

    <!-- mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
    $whatsOn = get_whats_on_now($todays_date);
    display_whats_on_now($whatsOn);
    <!-- /mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->

    I’ve set page cache to “Basic”.

    I’ve selected late initialization.

    Any insight would be highly appreciated!

    Thanks!

  • The topic ‘Need clarification of scope for W3TC fragment caching’ is closed to new replies.