• The next version of WP Super Cache will be released next week. If you use the dynamic cache functionality you’ll want to prepare.

    Support for the mfunc/mclude/dynamic-cached-content tags will be removed.

    In their place is a filter called wpsc_cachedata. You can use a WP Super Cache plugin to hook on to that and add or change template tags. It’s a lot safer than running exec() on potentially unknown code.

    Download the development version of the plugin on a test server and upgrade your theme if you need to show dynamic content on your site.

    There’s more information here, including test code: https://ocaoimh.ie/y/5b

    https://www.ads-software.com/extend/plugins/wp-super-cache/

Viewing 15 replies - 1 through 15 (of 27 total)
  • Hi,

    Just wondering how this method is supposed to work when you want to replace your template tag with a function like get_sidebar() which requires the use of ob_start() to get the output so it can be replaced in the output string.

    Am I missing something?

    Thanks!

    Output buffers can be nested so as long as you get the contents of the buffer and clean/close it properly there shouldn’t be an issue.

    I tried the following code:

    add_cacheaction("wpsc_cachedata", "ch_replace_dynamic_content");
    function ch_replace_dynamic_content($cachedata) {
        ob_start();
        print "test";
        $cachedata .= ob_get_clean();
    
        return $cachedata;
    }

    But I get the following error:

    Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in xxxxxx.php

    Any tips?

    Do you have compression enabled in your php.ini?

    I searched for that error message and the first result says to turn compressed output buffers off.

    Not that I can see. I checked my php.ini and also my runtime phpinfo(); Doesn’t look like it. Anything else you could recommend?

    Just to confirm does the code I posted work for you?

    Unfortunately I don’t have time to test it and I don’t use this functionality on any of my sites. If I have time to, I’ll test it out later.
    Unfortunately I don’t know why you’re seeing that error message. ??

    What is dynamic cache functionality? Am using mod_rewrite. Is that dynamic cache? Can anyone explain this to me?

    Dynamic caching means to have components on your page that are not cached with the plugin. This bits will always be executed when a user loads the page. This is useful for displaying content that needs to change on every page load.

    Hi Donncha,

    I’m pretty sure you can’t use output buffering functions inside an output buffering handler function.

    See: https://php.net/manual/en/function.ob-start.php in the section output_callback.

    Does this mean as of version 1.4 we won’t be able to use dynamic content in page caching?

    Nathan

    Will this new version of WP Super Cache resolve the issue of corrupted cache which makes WP Super Cache display Blank Pages on the home page and other important pages?

    Will this new version of WP Super Cache resolve the issue of corrupted cache which makes WP Super Cache display Blank Pages on the home page and other important pages?

    @nathanfranklinau – As it currently stands you won’t be able to use an output buffer because of that restriction.

    There are 2 ways around it – the plugin could use a shutdown function to push the page to the browser which would happen after the ob callback so you could use a new output buffer. I tried implementing this but it’s troublesome because of the way processing the output buffer is done. I’m not sure if I’ll get this into the plugin before the next release.

    Or you use Javascript to insert the right content where it should go. If I wanted to create dynamic sections of my page I’d use this and not sacrifice caching speed at all.

    @young Master – I don’t know. This might be an issue with your hosting or a bug in the plugin or a conflict with another plugin. That report is too vague, you’ll have to try to debug it I’m afraid.

    Hi Donncha,

    For now, I have rolled back to 1.3.2 and I have added a cache secret key to the code like W3 Total Cache does it.

    Have you made any other changes to 1.4 like bug fixes or anything else like that?

    Nathan

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘mfunc is going away in the next version’ is closed to new replies.