註冊完成自動登入
Auto Login After Registration in WordPress
<?php public function auto_login($user_id){ $user = wp_set_current_user($user_id); wp_set_auth_cookie($user_id); if ( is_wp_error($user) ){ echo $user->get_error_message(); }else{ wp_safe_redirect( UP()->logged_url ); } }