Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2017 14:34
What would you like to do?
[WordPress] What Are WordPress User Caches?
$user = get_user_by( 'login', $username );
$user = get_user_by( 'email', $email );
// Clean out any cookies and cookies for an existing user.
clean_user_cache( $user->ID );
// 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