Users: Pass the ID of the user that was logged out to the `wp_logout` action.

Props donmhico, figureone, TimothyBlynJacobs, rebasaurus.
Fixes #49533.
Built from https://develop.svn.wordpress.org/trunk@47553


git-svn-id: http://core.svn.wordpress.org/trunk@47328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-04-07 16:14:10 +00:00
parent 78e62aa3e4
commit 195312ead2
2 changed files with 8 additions and 3 deletions

View File

@ -573,16 +573,21 @@ if ( ! function_exists( 'wp_logout' ) ) :
* @since 2.5.0
*/
function wp_logout() {
$user_id = get_current_user_id();
wp_destroy_current_session();
wp_clear_auth_cookie();
wp_set_current_user( 0 );
/**
* Fires after a user is logged-out.
* Fires after a user is logged out.
*
* @since 1.5.0
* @since 5.5.0 Added the `$user_id` parameter.
*
* @param int $user_id ID of the user that was logged out.
*/
do_action( 'wp_logout' );
do_action( 'wp_logout', $user_id );
}
endif;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47552';
$wp_version = '5.5-alpha-47553';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.