Support » Plugin: W3 Total Cache » MFUNC still not working

  • So I did it like in the FAQ says, first I inserted this line

    define('W3TC_DYNAMIC_SECURITY', 'my_string');

    into my wp-config.php. Then, I modified my single.php to having this:

    <!-- mfunc {my_string} -->
    <?php get_sidebar(); ?>
    <!--/ mfunc {my_string} -->

    No dice. So I tried the other way

    <!-- mfunc {my_string} get_sidebar(); -->
    <!--/ mfunc {my_string} -->

    No luck either. Am I doing something wrong?

    http://wordpress.org/extend/plugins/w3-total-cache/

Viewing 11 replies - 31 through 41 (of 41 total)
  • This is temporary solution on version …11

    First define in wp-config.php

    define('W3TC_DYNAMIC_SECURITY', 'secureword');

    <!-- mfunc secureword -->
     echo "code";
     <!-- /mfunc secureword -->

    BUT!!! This is working when i do not use minify in W3TC settings, thats why it is temporary solution. Perhaps minify is deleting <!– …

    I can confirm that minify does, indeed, delete mfunc/mclude comment strings. However, you can set mfunc and mclude to the ignore comments list in HTML minify settings. Unfortunately, doing so doesn’t fix our issue either.

    When minify is used, fragmented caching definitely does not work as it should.

    Thread Starter azn137

    (@azn137)

    Ah, so minification works so well, it whacks its own code?

    Indeed. W3TC should add mfunc/mclude ignore functionality into its minifier and then process any mfunc/mclude calls before it’s sent to the user. This is obviously the expected behavior but we lost the functionality several versions back.

    Hi,
    Well, to make it work I have to:
    page cache disk + late “init”
    exclude mfunc form minify
    add define(‘W3TC_DYNAMIC_SECURITY’, ‘secureword’); in wp-config.php
    and use:
    <!–mfunc secureword –>
    wpads(‘article’);
    <!–/mfunc secureword –>

    Hope it will help 😉

    Eric

    I have not been able to duplicate any issues with it together with Minify. mfunc code can only be used with theme template files, post/page content or widget areas. That is displayed content that is cached by the Page Cache.

    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.

    Hey guys, sorry for the resurrection, this just seems like the only place that makes any sense regarding this. I have one question, why isn’t it okay to do the

    define( 'W3TC_DYNAMIC_SECURITY', 'mysecretcode' );

    inside the functions.php file for example, this works on my end but I’m building a theme for selling so I have to be sure.

    Hi Arnarstef,

    The W3TC_DYNAMIC_SECURITY is ‘just’ a constant. As far as i know it wont be a problem if you define this in functions.php. But i’ll say: try it and look if it works 😉

    It’s better to define it in wp-config.php, especially with the late init setting.

    Could you elaborate as to why it is better? Is it going to cause problems if it’s defined a bit later in the functions.php file?

    I don’t know the exact mechanics of W3TC, but the plugin could pull and push the cache out even before the theme’s functions.php is loaded. Also, with user agent groups showing mobile/tablet-specific themes, defining it in one location would make sense.

Viewing 11 replies - 31 through 41 (of 41 total)
  • The topic ‘MFUNC still not working’ is closed to new replies.