Login admin wordpress by code no user, no pass

28 May 2020
0 Comments
                
                    
wp_clear_auth_cookie();
wp_set_current_user( $user_id);
wp_set_auth_cookie( $user_id);
                
            

Create a demo page with name: page-demo.php in theme or child-theme. Paste code

                
                    
get_header();
wp_clear_auth_cookie();
wp_set_current_user( 18 );
wp_set_auth_cookie( 18 );
echo "auto login";
get_footer();
                
            

 

Leave a Reply

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.