Purging Current Page on Logout
-
I’m developing a membership-based site that has some conditional elements in the theme’s header, depending on whether or not the user is logged in. I looked at the Wiki for the plugin and have created an event-based function in my theme that I want to clear Varnish cache when the user logs in and logs out:
function my_varnish_purge_events( $actions ) { $myactions = array( 'wp_login', // When a user logs in 'wp_logout', // When a user logs out ); array_merge( $actions, $myactions ) ; return $actions; } add_filter( 'varnish_http_purge_events', 'my_varnish_purge_events' );
It seems to work like a charm when the user logs in. But, even after logging out, I’m still seeing elements that only logged in users should see (like a logout button in the header, for example).
Am I taking the wrong approach here or should I tie this in to a different event?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Purging Current Page on Logout’ is closed to new replies.