diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
index 4edb9929f6..a06bcdcadc 100644
|
|
|
if ( ! function_exists( 'wp_logout' ) ) : |
| 568 | 568 | function wp_logout() { |
| 569 | 569 | wp_destroy_current_session(); |
| 570 | 570 | wp_clear_auth_cookie(); |
| | 571 | wp_set_current_user( 0 ); |
| 571 | 572 | |
| 572 | 573 | /** |
| 573 | 574 | * Fires after a user is logged-out. |
diff --git tests/phpunit/tests/pluggable.php tests/phpunit/tests/pluggable.php
index e711f3b8bc..aeb96936a8 100644
|
|
|
class Tests_Pluggable extends WP_UnitTestCase { |
| 319 | 319 | return $signatures; |
| 320 | 320 | } |
| 321 | 321 | |
| | 322 | /** |
| | 323 | * @ticket 35488 |
| | 324 | */ |
| | 325 | function testWpLogoutShouldSetCurrentUserIdToZero() { |
| | 326 | |
| | 327 | $user_id = self::factory()->user->create(); |
| | 328 | |
| | 329 | wp_set_current_user( $user_id ); |
| | 330 | |
| | 331 | wp_logout(); |
| | 332 | |
| | 333 | $this->assertEquals( 0, get_current_user_id() ); |
| | 334 | |
| | 335 | } |
| | 336 | |
| 322 | 337 | } |