wp_destroy_current_session() WordPress Function

The wp_destroy_current_session() function is a WordPress function that destroys the current session. This function is useful for when you need to log out a user or end a session for security reasons.

wp_destroy_current_session() #

Removes the current session token from the database.


Source

File: wp-includes/user.php

function wp_destroy_current_session() {
	$token = wp_get_session_token();
	if ( $token ) {
		$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
		$manager->destroy( $token );
	}
}


Top ↑

Changelog

Changelog
VersionDescription
4.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More