Last active
January 30, 2021 16:30
-
-
Save kowsar89/c623960962d150243cad7a3d4242e7cf to your computer and use it in GitHub Desktop.
Auto login as WordPress Admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('wp-load.php'); | |
$user_id = 1; // Assuming admin user id is 1 | |
wp_set_current_user($user_id); | |
wp_set_auth_cookie($user_id); | |
if ( is_user_logged_in() ) { | |
header('Location: '.admin_url()); | |
} | |
else { | |
echo 'Failed'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment