Created
March 13, 2016 23:48
-
-
Save dkrusky/53bb8d593ecc049e5afa to your computer and use it in GitHub Desktop.
Login to WordPress as administrator (or any other user) without knowing the username or password.
This file contains 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-config.php'); | |
$user_id = 1; // Default admin user id. (usually the first user entered into the database) | |
$remember = 1; // Remember Session (14 days approx) | |
$secure = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ? 0 : 1; // Use SSL | |
// Force authorization as the above user without password | |
wp_set_auth_cookie( $user_id, $remember, $secure ); | |
header('location: ./wp-admin/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment