Support » Plugins and Hacks » 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?


Viewing 15 replies - 16 through 30 (of 41 total)
  • It’s so strange, the following code works, but my function returns with an empty page on the second pageload (when the content is coming from cache). Do you have any idea what is the difference?

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

    the following code doesn’t work

    <!-- mfunc mystring setPostViews(get_the_ID()); -->
    <?php setPostViews(get_the_ID()); ?>
    <!-- /mfunc mystring -->

    I’ve been running into the same behavior. Unfortunately I don’t have a solution to post, just confirming that you’re not alone.
    However, now it’s working. I swear I didn’t change anything, but maybe I did and forgot. Who knows.
    It seems to be sporadic and I’m afraid it will crop up again as an issue for me.

    I just checked on the site I was having this issue with and sure enough it’s a problem again. Darn it.
    I’m just going to have to forget about fragment caching this for now until this gets resolved (if it ever does).

    If Frederick Townes is interested (or anyone else who is smart enough to be able to contribute to the W3TC plugin) I can make the site I’m experiencing this on available as a case study. Just let me know.

    One thing I have just noticed is that it only seems to happen with the home page. So the behavior is:
    Visit the home page for the first time – loads fine. Refresh that page and you get the white screen of death. Continuous attempts and ctrl+f5 – still get white screen.
    Visit any other pages of the site (that use the same fragment caching coding) and they all load fine. Refresh – no problem.

    Hi Frederick,

    Is there any news on this issue? Are we doing anything wrong? I do have two sites with this issue now. Please response.

    I tried this on my localhost and it worked:

    — wp-config.php

    — theme files

    <!-- mfunc FRAGMENT_CACHING -->
        echo "Not being cached"
    <!-- /mfunc FRAGMENT_CACHING -->

    When it’s in production, it doesn’t work. The cached pages get built without the dynamic content but the content of the comment doesn’t show up in the html source code.

    So I got it working by switching Page Caching to Disk:Basic and checking the Use Late “Init” checkbox. I guess I probably should have read the line “Adds support for use of WordPress functionality in fragment caching calls” sooner.

    Hey there,

    Haven’t tried abecoffman’s workaround yet so I can’t comment on that, but I would very very much like a good, stable fix for this functionality. It is absolutely essential functionality.

    Thanks to Frederick for your work!

    Plugin Author Frederick Townes


    If you use Disc:Enhanced have you tried deleting the cache/page_enhanced/yoursite folder manually through FTP? the cache engine stores .old files so it can load old pages when rebuilding new ones. However it takes some time before those are removed so can create conflict with fragment cache. This is because the old cache files are loaded instead of the new ones.

    Also if you use fragment cache on all pages its not recommended to use Disc:Enhanced since fragment cache with Disc:Enhanced prevents caching of pages.

    For those of you who are interested, you can go look at the regex that’s being used to extract the code out of the html comment. The issue I was having was determining when this code executes, which Frederick seems to have cleared up.


    Has someone found a way to use mfunc ? I tried different possibilities to get my ads rotate but always not working…
    My ads code in page is: <?php wpads(‘article’); ?>

    If someone have an idea…

    Hi Frederick,

    Thnx for your reply.

    Unfortunately it didn’t work out. There are no .old files, so no need to delete those. I’ve tried basic and enhanced cache. The first one with and without the late init option one.

    What am I missing?

    I’m getting a bit frustrated…

    I really appreciate this plugin, but when the fragment caching is not working, some of my sites are not working correctly.

    If there is anyway to get more support, i’d like to know.

    We just updated to and our mclude calls are still being ignored (they show up as HTML comments in the minified HTML).

    Something isn’t looping over the HTML content after it’s pulled from cache and processing the fragmented code blocks before sending it to the browser.

    I would also like to chip in that I’m also struggling to get this to work, which is quite a problem for me on a few sites. Still a great plugin I just need to get this functionality working.

    Im using WP 3.5.1 and version, Using Disc:Basic & also Use late “init”.

    Have tried different combinations of mfunc code, as I’m sure everybody else has, but the output still gets cached.


    If I do this:

    <? $test = “testing”; ?>

    <? echo $test; ?>

    I get the expected result.

    If I do this:

    <? $test = “testing”; ?>

    <!–mfunc mysecret –> echo $test; <!–/mfunc mysecret –>

    I get nothing – nothing echos out.

    If I run this though:


    <!–mfunc mysecret –>
    echo rand();
    <!–/mfunc mysecret –>


    That works, so I know that W3TC is recognizing those tags and running the code im between as php…

    Any thoughts on this? I’m stuck because it won’t echo what I need it too,


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