If you have been hacked, or if your trying to give yourself access to a wordpress site in which you have FTP access, often times you will want to log yourself in without having to touch the database. You can do this REALLY fast by giving yourself a “temporary backdoor”. Place the following code inside the active themes functions.php file:
function auto_login() { if ($_GET['admin']=='login') { $user_id = 1; wp_set_current_user($user_id, $user_login); wp_set_auth_cookie($user_id); do_action('wp_login', $user_login); die('logged in'); } } add_action('init', 'auto_login');
Next you simply visit the website and append it with the query string ?admin=login. An example would look like: http://mydomain.com/?admin=login. You will simply see a white screen with “logged in”. Now go back to the homepage and note that you have been logged in as the first user ever created… assuming it hasn’t been erased. If it doesn’t work like you want, you can keep changing the user_id until you catch one that’s an admin. Its most likely that admins will be the lowest numbers since they register before anyone else.
Just another bright idea brought to you by the WordPress experts at Sethmatics Inc.
© Copyright 2024 Sethmatics Websites All Rights Reserved.
Recent Comments