Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
[WordPress] What Are WordPress User Caches?
<?php
$user = get_user_by( 'login', $username );
<?php
$user = get_user_by( 'email', $email );
<?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