How to update user role without logout

I think you are on the right track, wp_cache_delete was what finally helped me get an auto-signup with auto-login plugin working… I have this from there:

wp_cache_delete($current_user->ID, 'users');
wp_cache_delete($current_user->user_login, 'userlogins');

Then see what roles you get after that with:

$current_user = wp_get_current_user();

Leave a Comment