This article covers the steps of changing the admin email with WP-CLI.
WP-CLI (WordPress Command Line Interface) allows you to efficiently manage your WordPress site, including updating the admin email.
Follow these steps to update the admin email address using WP-CLI:
Step 1: Access Your Server via SSH
To begin, you need to connect to your WordPress site via SSH. You will need the SSH credentials for your server and a terminal application like PuTTY (for Windows) or the terminal application on Linux/Mac.
- Log in to your server using the following command:
ssh your_username@your_server_ip
- Enter your SSH password when prompted.
Step 2: Navigate to the WordPress Directory
Once logged in to your server, navigate to the directory where WordPress is installed. Use the “cd” command for this.
- If your WordPress files are in the “public_html” directory, you would run:
cd /path/to/your/wordpress/installation
- For example:
cd /var/www/html
Step 3: Check the Current Admin Email
- To confirm the current admin email address before changing it, you can run the following WP-CLI command:
wp option get admin_email
This will return the current admin email address of your WordPress site.
Step 4: Change the Admin Email Address
- To update the admin email address, use the subsequent WP-CLI command:
wp option update admin_email ‘[email protected]’
Replace ‘[email protected]’ with the new email address you want to use.
Step 5: Verify the Change
- Once you have changed the email, you can verify the update by running:
wp option get admin_email
This should return the new email address you just set.
Additional Notes:
- Email Verification: Depending on your WordPress settings, an email may be sent to the new address for confirmation. Ensure to verify the new email by following the instructions in the email.
- Role Permissions: Ensure you have the necessary permissions to run WP-CLI commands and modify site options.
By following these steps, you can quickly and easily update the admin email address using WP-CLI without needing to access the WordPress dashboard.
After changing the admin email, you may need to update your password to secure your account. Check out our guide to resetting your WordPress user password using WP-CLI.