WordPress on Azure App Service admin password not working

Arunansu Pattanayak 92 Reputation points Microsoft Employee
2023-05-30T13:02:10.85+00:00

Created a blog using WordPress on Azure App Service. The blog was working fine and even was able to create few blogs and update admin profile with email and set display name. After that suddenly the admin password is not working. Checked in App Service configuration that password is still the same. Tried lost password link. It said password rest link was sent to email. But I did not get any email.

How can I retrieve or reset the admin password in my WordPress on Azure App Service?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,349 questions
0 comments No comments
{count} vote

Accepted answer
  1. Grmacjon-MSFT 17,366 Reputation points
    2023-05-30T23:18:18.1033333+00:00

    Hi Arunansu ,

    How long has it been since you requested password reset link?

    The official WordPress Document shares 7 different ways to reset your password. Since it looks like you have already tried the first few options mentioned, here are a few additional ways you can reset your password based on the WP doc:

    1.Through FTP

    There is also an easy way to reset your password via FTP, if you’re using the admin user.

    1. Login to your site via FTP and download your active theme’s functions.php file.
    2. Edit the file and add this code to it, right at the beginning, after the first <?php
    wp_set_password( 'my_new_password', 1 );
    

    In the above code, replace the text my_new_password with your own new password for the main admin user. The number 1 above refers to the user ID number in the wp_users database table. Since we wanted the user ID of the main admin user, we just keep the number as 1, which is typically the user ID of the main admin user.

    1. Upload the modified file back to your site.
    2. Once you are able to login, make sure to go back and remove that code. It will reset your password on every page load until you do so.

    2.Through WP CLI

    WP CLI is a command line tool for managing your WordPress installation.

    1. Move into the /wordpress directory and type
    $ wp user list
    

    to see all users. Find the ID of the user you’d like to update.

    1. Then, update the user
    $ wp user update 1 --user_pass=$UP3RstrongP4$w0rd
    

    replacing “1” with the id of the user you want to update.

    More on wp cli

    3.Using the Emergency Password Reset Script

    If the other solutions listed above won’t work, then try the Emergency Password Reset Script. Please note that it’s not a plugin, it’s a PHP script.

    A Word of Caution:

    1. The Emergency Password Reset Script requires that you know the administrator’s username.
    2. It updates the administrator password and sends an email to the administrator’s email address.
    3. Even if you don’t receive the email, the password will still be changed.
    4. You do not need to be logged in to use it. (After all, if you could login, you wouldn’t need the script.)
    5. Place the script in the root of your WordPress installation. Do not upload it to your WordPress Plugins directory.
    6. For security reasons, remember to delete the script when you are done.

    Directions for Use:

    1. Copy the emergency script from Emergency Password Script and put into a file called emergency.php in 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.
    4. 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.

    Hope that helps.

    Best,

    Grace

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful