$user = get_user_by('id', $userid);
wp_clear_auth_cookie();
wp_set_current_user($user->data->ID);
wp_set_auth_cookie($user->data->ID);
PHP Code to login a user programatically in WordPress
By - Admin, Updated on February 22, 2024
Keep Reading
👋 Hi, Find this Helpful? There is More
How to create Custom Sections in Shopify[Dawn Theme]
Are you looking to customize your Shopify store beyond the standard templates and themes? Do you want to create unique...
Know More »