• Hi,

    First, thank you for the excellent plugin. I’m trying to prevent the date from caching on the main page of my site, monthlyreview.org. I insert the date using a filter in functions.php. It is a simple php date, i.e., date(‘l F jS, Y’). Problem is that it gets cached with the main page and doesn’t change. from day to day, even though I have garbage collection set to 1 hour.

    Is there any way to prevent the date from getting cached?

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Jamil Jonna

    (@jonna)

    So actually slogged through the documentation (which needs updating) and have been trying to use the mfunc but to no avail. Here is the function I created in my plugin (just a set of custom actions for my site):

    function mr_time() {
    
    		$d = "date( 'l F jS, Y, g:i a (T)' )";
    		$cd = '<!--mfunc ' . $d . ' -->';
    		$datec = date( 'l F jS, Y, g:i a (T)' ) . '<!--/mfunc-->';
    		$date = '<div class="todays-date">' . $cd . $datec . '</div>';
    
    		echo $date;
    }

    The uncached page works correctly. Cached versions show nothing. I’ve tried the quotation marks in all sorts of configurations since the date in mfunc renders otherwise.

    Any help is much appreciated.

    Plugin Author Donncha O Caoimh (a11n)

    (@donncha)

    and how are you calling the mr_time() function in your template?

    Thread Starter Jamil Jonna

    (@jonna)

    as an action.

    add_action( "{$prefix}_open_main", 'mr_time' );

    i’m using the hybrid theme framework. Oh, and I forgot to mention that I do have “Late init. Display cached files after WordPress has loaded. Most useful in legacy mode.” checked in Advanced.

    Plugin Author Donncha O Caoimh (a11n)

    (@donncha)

    Look in a cached page in wp-content/cache/ and see if the date command is in there. Also use the debug system to see if it uses legacy mode..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Super Cache] Prevent caching of PHP date’ is closed to new replies.