Create a WordPress admin user without access to the database (requires access to functions.php — either via FTP, SFTP or SSH)

If you ever find yourself without access to the database and WordPress backend but wanting to create a new admin user, simply paste the following script in your functions.php file.

The next step is to reset to follow the WordPress Reset Password steps. On the login page, click on Forgot My Password and enter either the email address or username entered in the script and follow the steps.

Once you’ve logged in, please make sure you delete the password reset function.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store