• Resolved timboc

    (@timboc)


    The homepage on this site has dynamic content, which doesn’t update when it changes. I have to disable Docket Cache and re-enable it – and even then, the updated content is not always shown.

    How can I exclude the home page from caching so that it always shows the latest content, please?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi there,

    Docket Cache is an object cache plugin, it cant exclude certain pages like page caching does. But we can clear the cache when there are new posts or updates. Copy this mu-plugin code into wp-content/mu-plugins/docketcache_flush_when_save_post.php

    <?php
    // Place this code in wp-content/mu-plugins/docketcache_flush_when_save_post.php
    add_action('docketcache/init', function($docket_cache_instance) {
    $docket_cache = $docket_cache_instance;

    add_action( 'save_post', function($post_id, $post, $update) use($docket_cache) {
    $result = $docket_cache->flush_cache(true);
    $docket_cache->co()->lookup_set('occacheflushed', $result);
    do_action('docketcache/action/flush/objectcache', $result);
    }, 10, 3);
    });

    Thanks.

    Thread Starter timboc

    (@timboc)

    Thank you for your quick response. I have now done that. Will this get overwritten/deleted when the plugin gets updated, or is this a permanent fix please?

    Plugin Author Nawawi Jamili

    (@nawawijamili)

    Will this get overwritten/deleted when the plugin gets updated

    No.

    or is this a permanent fix

    Yes, unless you remove that mu-plugins script.

    Thread Starter timboc

    (@timboc)

    Brilliant. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.