bishawjit-das
7/29/2016 - 2:18 PM

Single logout for all multisite login

Single logout for all multisite login

// Single logout from all sites
function clear_session_on_logout() {

	$current_user = wp_get_current_user();

	// get all sessions for user with ID $user_id
	$sessions = WP_Session_Tokens::get_instance($current_user->ID);

	// we have got the sessions, destroy them all!
	$sessions->destroy_all();
}
add_action('clear_auth_cookie', 'clear_session_on_logout');