[WordPress] What Are WordPress User Caches?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = get_user_by( 'login', $username ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = get_user_by( 'email', $email ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Clean out any cookies and cookies for an existing user. | |
clean_user_cache( $user->ID ); | |
wp_clear_auth_cookie(); | |
// Set the current user and update the caches. | |
wp_set_current_user( $user->ID ); | |
wp_set_auth_cookie( $user->ID, true, false ); | |
update_user_caches( $user ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment