Archive for the ‘Uncategorized’ Category

How to reset your wordpress administrator password

Tuesday, November 10th, 2009
  1. Save the file from the download link below into your root wordpress directory, then go to your WordPress site (
  2. Select the administrator account from the drop down, enter a new password and click the button to reset it

Wordpress reset script download

Here’s the PHP code with commenting for anyone interested in how it works

//Load wordpress bootstrap and include containing the registration functions

//Create empty array to hold a list of usernames and their id for our dropdown
$users = array();
//Create empty array to hold our user info for the WordPress update function
$user = array();
//Loop through each user in the database and add them to our users array if they're an admin
while($u = get_userdata(++$i)) {
    if(isset($u->wp_capabilities['administrator']) && $u->wp_capabilities['administrator'] == 1) {
        $users[$i] = $u->user_nicename;

// If our form has been submitted, process the information sent
if(isset($_POST['ID'])) {
    //Trim password and assign it to $pass
    $pass = trim($_POST['password']);
    //If the password is empty assign the information message
    if($pass == '') {
        $info = 'ERROR: Password needed in order to reset';
    //Otherwise set our array variables to pass to the update function
        $user['ID'] = $_POST['ID'];
        $user['user_pass'] = $pass;
        //Update the user
        //Assign message letting the user know the password has been set
        $info = 'User `'.$users[$user['ID']].'` updated successfully!';

As you can see, the process is fairly straightforward and will allow you to reset your password(s) to whatever you choose without the need of resetting via e-mail, then entering the new random password into the login and setting your password to the desired new password

If you have any questions, bug reports or want to simply comment feel free to contact me via the contact page