WordPress.org

Support

Support » Plugins and Hacks » W3 Total Cache » MFUNC still not working

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 15 replies - 1 through 15 (of 41 total)
  • Same here…

    I tried different combinations but it is not working.

    Plugin Author Frederick Townes

    @fredericktownes

    Please try like this: <!-- mfunc my_string -->

    Will improve the description in the next update.

    Awesome…

    It is working thanks

    Nope. That blew it up badly. http://i.imgur.com/epTsCVp.png

    Actually…it is not working….

    I ran different test in different browsers. The my_string was exposed in my HTML code. The mfunc did not work.

    It has worked for me. If you are seeing my_string exposed, then it means W3_total_cache is not seeing your code and replacing it. Are you sure you have the plugin enabled, preview mode disabled and page caching enabled?

    (oops, a duplicate because of a 503 error with the WP.org server)

    From test I’ve done it may depend if you’re using it with Cloudflare or not;

    This is the correct syntax when you are not using Cloudflare.

    <!– mfunc THE CODE WITHOUT PHP TAGS –>
    <?php THE CODE ?>
    <!– /mfunc –>

    Cloudflare will cause the page to fail to render when it hits the php code so you wouold be better off using mclude.

    @nic Windley: good debugging. That snippet seems to work.

    <!-- mfunc THE CODE WITHOUT PHP TAGS -->
    <?php THE CODE ?>
    <!-- /mfunc -->

    So, the bottom line is that the added security didn’t take effect?

    I just tried mfunc snippet as posted above, but it still does not seem to work. I have googled for hours but can’t find any definite answer on how to get page fragment caching to work.

    This does not work for me:

    <!-- mfunc echo date('h:i:s'); -->
    <?php echo date('h:i:s'); ?>
    <!-- /mfunc -->

    I tried lots of different mfunc snippets but did’t get it to work. Defining ‘W3TC_DYNAMIC_SECURITY’ in my wp-config.php does not help either.

    I use page cache (disk enhanced), database cache (APC) and object cache (APC), and I’ve already tried switching page cache to disk:basic or APC, but nothing seems to work.

    *sigh* I can confirm that it still doesn’t work either. My Jetpack Twitter feed doesn’t seem to update.

    My current workaround is set the page cache to be 43200, which is 12 hours, which is nowhere near perfect 🙁

    I tried a lot of combinations but none seem to take when I start testing. I tested it on different browsers logged out. The mfunc snippet is all exposed.

    Hallelujah! That worked for me!
    @kokoschka – It looks like you’re still leaving out the security_string part of the <!– mfunc –> deal.

    Here’s what worked for me:

    Added this line of code to the wp-config.php file in the root of the wordpress installation:
    define('W3TC_DYNAMIC_SECURITY', 'mysecretcode');

    Then used this code where I wanted the PHP to be run un-cached:

    <!-- mfunc mysecretcode -->
      echo 'testing php execution';
      x = 10;
      echo x;
      whatever php code you want
    <!-- /mfunc mysecretcode -->

    Remember, the <!– mfunc –> comments actually REPLACE the <?php ?> tags. Kokoschka appears to be including the <?php ?> tags within the <!– mfunc –> tags which is not how it works.

    It’s not working for me.
    The mfunc function never seems to work correct with me… and i’ve tried every combination possible.

    What i’ve done so far:

    1.
    <!-- mfunc mysecret mother_off_all_forms(); --><!-- /mfunc mysecret -->
    
    2.
    <!-- mfunc mysecret echo mother_off_all_forms(); --><!-- /mfunc mysecret -->
    
    3.
    <!-- mfunc mysecret -->mother_off_all_forms();<!-- /mfunc mysecret -->
    
    4.
    <!-- mfunc mysecret --><?php mother_off_all_forms();?><!-- /mfunc mysecret -->
    
    5.
    <!-- mfunc mysecret mother_off_all_forms --><?php mother_off_all_forms(); ?><!-- /mfunc mysecret -->
    
    6.
    <!-- mfunc mysecret  function1() --><?php function2() ?><!-- /mfunc mysecret -->

    #4 and #5 are returning the function, but it is not excluded from the cache.

    #1 and #2 are only returning the function when im logged in, when i’m logged out there is no result

    #3 is just showing the text.

    I’m kind a frustrated. The whole mfunc function seems to be buggy, because it never works as described in de FAQ.

    Update with #6
    When i’m logged in (= page cache off), function 1 is being executed. When I’m logged of (= page cache on), function 2 is executed (and is cached).

    Same here…I tried a lot of different combinations and can never get it to work when I log out of WordPress.

Viewing 15 replies - 1 through 15 (of 41 total)
  • The topic ‘MFUNC still not working’ is closed to new replies.
Skip to toolbar