Skip to content

Instantly share code, notes, and snippets.

@kowsar89
Last active January 30, 2021 16:30
Show Gist options
  • Save kowsar89/c623960962d150243cad7a3d4242e7cf to your computer and use it in GitHub Desktop.
Save kowsar89/c623960962d150243cad7a3d4242e7cf to your computer and use it in GitHub Desktop.
Auto login as WordPress Admin
<?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