Support » Plugin: WP Super Cache » [Plugin: WP Super Cache] mfunc issue

  • When I enable the plugin “htaccess” or “php” mode, everything loads okay up until the sidebar.

    When I view the page source, there is an <!–mfunc–> and then nothing else following that. It appears php/page execution stops after this line…

    I’ve got woocommerce plugin, and a customized theme running, but can’t for the life of me figure out what is going on…

    Any ideas?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Donncha O Caoimh


    Try enabling the late init option on the settings page.



    FAQ suggestion:

    The FAQ says “To execute WordPress functions you must define $wp_super_cache_late_init in your config file.

    Which config file? Where? How? Why? This is pretty confusing and misleading.

    Suggestion: The FAQ should instead say you have to enable it on the Advanced page. I had to find this forum post to learn this, because I didn’t remember there was an option like that on the Advanced page….

    Best wishes,

    Plugin Author Donncha O Caoimh


    Thanks. When that FAQ was written the advanced settings page option didn’t exist. I’ll update it.

    Olaf Lederer


    Hi Donncha,
    I thought I got working, but not for 100%

    My theme file includes a file and a function from that file is called later:

    <!--mclude wp-content/box-cache/switch-content-home.php-->
    <?php include_once( ABSPATH . 'wp-content/box-cache/switch-content-home.php' ); ?>
    <!--mfunc showHTML()-->
    <?php showHTML() ?>

    After the cache file is created I see exact the same code in that file (except for the file path, where the absolute path variable shows the value) Inside the included file I get different ads for a specific country.

    I get the content from the showHTML() function at the moment that the page is generated, but the content is gone after the second page view.
    Does this sound familiar? I tried the function a second time in a simple way using this function:

    function showHTML() {
    	$somevar = 1;
    	echo ($somevar == 1) ? 'this is one' : 'this is not';

    But in that case I get the first message only once. If I access the cache file from the browser directly, it’s working. Seems like that the PHP code isn’t executed when the cache file is called by WordPress.

    Plugin Author Donncha O Caoimh


    Try putting a space before the “–>” string. Does that help?

    Have you tried the “dynamic-cached-content” tag too?

    Hi Donncha,

    I tried them both, no success 🙁
    The strange thing is that my cache file looks 100% good, it’s just the PHP code isn’t executed inside the PHP (cache) file.

    Do you have a working example?

    Plugin Author Donncha O Caoimh


    Have you made sure that PHP executes when you view a cached page? Use the debug log, make sure the supercache rewrite rules aren’t in your .htaccess file.

    Hi Donncha,

    I removed the rules by myself and if I access the cache file directly everything is fine. If check the cache time stamp from the public url, I have the same cache file. It’s only the PHP part which isn’t executed. If you like I can create an example (I hoped you have an working example)

    Plugin Author Donncha O Caoimh


    I don’t have a working example and since my site uses Varnish mfunc won’t work. You might need to debug the mfunc code in wp-cache-phase2.php with error_log to figure out what’s going wrong.

    Hi Donncha,
    I got it working and I think the problem was inside the (included) script.
    After the cached page was generated all the wordpress settings were missing (I guess). That’s the only explanation I have because suddenly it worked. Thanks for the help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WP Super Cache] mfunc issue’ is closed to new replies.