WordPress

WordPress Emergency Password Script

Every once in a while, we meet a company who has WordPress hosted on a server that can’t send out email. This spells out doom when you’ve lost the password to WordPress and you need to login to retrieve it. WordPress stores the password encrypted, so even having access to the database doesn’t help. But if you have access to the server via FTP, you can actually upload a script that will allow you to reset the administrative password via a page. Here’s the information from the site:

Warnings

  1. Requires you know the administrator username.
  2. It updates the administrator password and sends an email to the administrator’s email address.
  3. If you don’t receive the email, the password is still changed.
  4. You do not need to be logged in to use it. If you could login, you wouldn’t need the script.
  5. Place this in the root of your WordPress installation. Do not upload this to your WordPress Plugins directory.
  6. Delete the script when you are done for security reasons.

Directions for use

  1. Save the script below as a file called emergency.php to the root of your WordPress installation (the same directory that contains wp-config.php).
  2. In your browser, open http://example.com/emergency.php.
  3. As instructed, enter the administrator username (usually admin) and the new password, then click Update Options. A message is displayed noting the changed password. An email is sent to the blog administrator with the changed password information.
    Delete emergency.php from your server when you are done. Do not leave it on your server as someone else could use it to change your password.

Here’s the code within a text file. Rename emergency.txt to emergency.php and place it in the root of your WordPress installation. AS WARNED: Remove the file after use!

2 Comments

  1. 1
  2. 2

Leave a Reply