2

After pushing a staging site to production I have [email protected] set as the admin email which I need to change. Obviously I can't access that email to verify the change because it doesn't exist so I wrote this query:

UPDATE wp_options SET option_value = '[email protected]' WHERE option_name = 'admin_email'

I found this related answer but I do not use phpMyAdmin.

Is this an OK method to override this? Or is there a more proper method?

3

1 Answer 1

2

While your SQL query will probably do the trick, you don't need to interface directly with the database to accomplish this.

The preferred methods would by using Wordpress' update_option() function or by running the WP-CLI command:wp option update.

Via update_option()

To override the admin email change confirmation process, add the following to your functions.php file and hit "save changes".

update_option( 'admin_email', '[email protected]' );

Then once you've verified that the change worked, you can go back to your functions.php and remove the snippet.


Via WP-CLI

If you have WP-CLI installed, you can run the following command from your shell/terminal (much faster):

wp option update admin_email [email protected]

If WP-CLI is owned by root, you'll obviously need to run it with sudo. Success will give you the following output:

Success: Updated 'admin_email' option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.