• Resolved jimk1416

    (@jimk1416)


    A while back I was given some code that could be added to the functions.php file to clear the cache on logout.
    Can you verify this code will still work. I’ve seen some issues where it does not seem to work

    function clear_cache_on_logout() {
    if (class_exists('WP_Optimize')) {
    WP_Optimize()->get_page_cache()->purge();
    }
    }
    add_action('wp_logout', 'clear_cache_on_logout');
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jimk1416

    (@jimk1416)

    I have several websites and noticed this is working on some but not all. So maybe there is a conflict with some other plugin.

    Plugin Support Damilare

    (@deabiodun)

    Hi!
    If that code is not working on some sites, you can try the one below

    add_filter( 'wpo_purge_cache_hooks', function( $actions ) {
    $actions[] = 'wp_logout';
    return $actions;
    } );

    Let me know if that helps.

    Regards.

    Thread Starter jimk1416

    (@jimk1416)

    That code didn’t work on one of the sites either.
    Probably just need to find that plugin that is creating the conflict.

    Will report back if I find it.

    Thread Starter jimk1416

    (@jimk1416)

    It appears to be the White Label CMS plugin that is preventing the cache from being cleared during logout. Don’t know if there is a fix?

    Thread Starter jimk1416

    (@jimk1416)

    The plugin Disabled Source, Disabled Right Click and Content Protection also prevents the caching on logout.
    Not a big deal thanks.

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

The topic ‘Clear cache on logout’ is closed to new replies.