Created
March 16, 2026 07:20
-
-
Save hgc81538/722a77761174a66e6783529e512b297c to your computer and use it in GitHub Desktop.
WordPress auto login as 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 | |
| require __DIR__ . '/wp-load.php'; | |
| if (!empty($_REQUEST['autologin']) && $_REQUEST['autologin'] === '{{token_1}}') { | |
| $user_id = get_user_by('login', 'admin')->ID; | |
| wp_set_current_user($user_id); | |
| wp_set_auth_cookie($user_id); | |
| } | |
| unlink(__FILE__); | |
| wp_redirect(site_url() . '/wp-admin/'); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment