Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created May 18, 2017 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/e2c4ab9269420c3577485d36c373c54d to your computer and use it in GitHub Desktop.
Save tommcfarlin/e2c4ab9269420c3577485d36c373c54d to your computer and use it in GitHub Desktop.
[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