How to change main admin email address in WordPress without notification and confirmation processes
There is a 'secret' settings page which lets you change all of the settings in the options table.
Access it by changing the URL from /options-general.php to /options.php
The one that you are trying to replace is actually the email in Wordpress settings, not the wp user email. That one can be changed directly in database in the table wp_options
where option_name
is admin_email
Or with the given update query:
UPDATE `wp_options` SET `option_value` = '[email protected]' WHERE `option_name` = 'admin_email';
There are few ways to change admin email without using a 3rd party plugin.
Also, besides admin_email, there is another value that needs to be changed.
No matter that you change admin_email
value in DB, a confirmation notice will remain,
unless you change new_admin_email
too.
Updating via the database:
In case of updating option via DB directly, there are two options that need to be changed: admin_email
and new_admin_email
.
UPDATE wp_options SET option_value = '[email protected]' WHERE
option_name LIKE 'admin_email'
OR
option_name LIKE 'new_admin_email';
note: While by default every WordPress database has wp_
prefix for its tables, they can be changed, so check in wp-config.php for $table_prefix
value.
Updating via options.php:
Another way without the use of some plugin is as mentioned accessing secret page /wp-admin/options.php
. However, there might be too many options, and due to a number of $_POST
variables limit set for each server differently, having it quite impossible to change it that way.
See more about max_input_vars
https://www.php.net/manual/en/info.configuration.php
Updating via functions.php in active theme:
You could set one time code (and delete it after) in functions.php of your active theme to update these options:
update_option( 'admin_email', '[email protected]' );
and
update_option( 'new_admin_email', '[email protected]' );
Put these within some admin_init
action callback.
Updating via wp-cli:
Another way to update Admin email is via wp-cli ( if you have access to terminal ssh):
wp option update admin_email '[email protected]'
and
wp option update new_admin_email '[email protected]'
see more about wp option commands:
https://developer.wordpress.org/cli/commands/option/update/