WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
mfunc issue (11 posts)

  1. wilsmex
    Member
    Posted 2 years ago #

    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?

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Try enabling the late init option on the settings page.

  3. Storm
    Member
    Posted 2 years ago #

    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,
    Storm

  4. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

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

  5. Olaf Lederer
    Member
    Posted 2 years ago #

    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' ); ?>
    <!--/mclude-->
    
    <!--mfunc showHTML()-->
    <?php showHTML() ?>
    <!--/mfunc-->

    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.

  6. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Try putting a space before the "-->" string. Does that help?

    Have you tried the "dynamic-cached-content" tag too?

  7. Olaf Lederer
    Member
    Posted 2 years ago #

    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?

  8. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  9. Olaf Lederer
    Member
    Posted 2 years ago #

    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)

  10. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  11. Olaf Lederer
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic