How to change the main admin email address in WordPress without notifications and confirmation processes

I created one site on an intermediate server. I want to change the admin email address for this staging site. Since at that time I want to test something on an intermediate site and I want that no email is sent to the client (the original administrator email), I want to change the main administrator email.

But when I change the admin email address, I get a confirmation link to my new admin email address.

The administrator’s email address will not change until I click on the link in the confirmation email.

After I click on the confirmation link, the initial administrator will receive a notification that the administrator’s email address has changed.

I want to disable the notification of a change in the administrator’s email address, as well as a new admin confirmation email address link in WordPress.

How can I do it? could you help me? Is there any code for this?

enter image description here

+26
source share
10 answers

There is a "secret" settings page that allows you to change all the settings in the parameter table.

Access it by changing the URL from /options-general.php to /options.php

+85
source

The one you are trying to replace is actually the email address in the Wordpress settings, not the wp user email. This can be changed directly in the database in the wp_options table, where option_name is admin_email

Or with a given update request:

 UPDATE `wp_options` SET `option_value` = ' new@email.com ' WHERE `option_name` = 'admin_email'; 
+8
source

Note. Get a dump and try first locally. Do not test in production.

Edit Using DB

 //email UPDATE `wp_users` SET `user_email` = "new_email_address" WHERE `wp_users`.`user_login` = "admin"; //password UPDATE `wp_users` SET `user_pass` = MD5('new_password_here') WHERE `wp_users`.`user_login` = "admin"; 

Check it out too

+3
source

Easier to use phpMyAdmin

wp_options> admin_email

+1
source

You must log in to MySQL server

and execute the following query

 UPDATE 'wp_options' SET 'option_value' = ' mail@email.com ' WHERE 'option_id' = 6; 
+1
source

There are several ways to change the administrator email address without using a third-party plugin.

In addition to admin_email, there is another value that needs to be changed. Regardless of the fact that you change the admin_email value in the database, a confirmation notification will remain if you do not change new_admin_email .

Update through the database:

In case of updating the option through the database, there are two options that need to be changed: admin_email and new_admin_email .

 UPDATE wp_options SET option_value = ' admin@example.com ' WHERE option_name LIKE 'admin_email' OR option_name LIKE 'new_admin_email'; 

note: although by default each WordPress database has the wp_ prefix for its tables, they can be changed, so check wp-config.php for the value of $table_prefix .

Update via options.php:

Another way, without using any plugin, is to access the secret page /wp-admin/options.php . However, there may be too many options, and due to the fact that for each server the $_POST variable limit is set differently, changing it in this way is completely impossible.

Learn more about max_input_vars https://www.php.net/manual/en/info.configuration.php

Update using functions.php in the active topic:

You can set one temporary code (and delete it after) in the functions.php of your active theme to update these parameters:

 update_option( 'admin_email', ' admin@example.com ' ); 

and

 update_option( 'new_admin_email', ' admin@example.com ' ); 

Put them in some admin_init action call admin_init .

Update via wp-cli:

Another way to update admin email is via wp-cli (if you have access to the ssh terminal):

 wp option update admin_email ' admin@example.com ' 

and

 wp option update new_admin_email ' admin@example.com ' 

see more about wp option commands:

https://developer.wordpress.org/cli/commands/option/update/

+1
source

Run this query. This will change the email id without confirmation.

 UPDATE `wp_users` SET `user_email` = 'newemail' WHERE `user_email` = 'old_email'; 
0
source

I had the same problem, so I wrote a plugin to roll back the link to the confirmation link. You can upload it to .org:

Change admin email setting without outgoing email

Here is the code:

 <?php /* Plugin Name: Change Admin Email Setting Without Outbound Email Plugin URI: https://wp-bdd.com/change-admin-email/ Description: Restores functionality removed since WordPress 4.9. Allows the changing of the admin email by admins in single site without outbound email or recipient email credentials. Version: 1.0 Author: John Dee Author URI: https://wp-bdd.com/ */ $ChangeAdminEmailPlugin = new ChangeAdminEmailPlugin; class ChangeAdminEmailPlugin{ public function __construct(){ //This plugin doesn't do anything unless it WordPres version +4.9 and single site if($this->isWordPressMinimiumVersion("4.9.0") && (!( is_multisite()))){ //pulls the default actions remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' ); remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' ); //When you actually complete the change, another email gets fired to the old address //this filter overides this: add_filter('send_site_admin_email_change_email', function(){return FALSE;}, 10, 3 ); //hooks our own custom method to update the email add_action( 'add_option_new_admin_email', array($this, 'updateOptionAdminEmail'), 10, 2 ); add_action( 'update_option_new_admin_email', array($this, 'updateOptionAdminEmail'), 10, 2 ); //this fixes the text in English. Translators wanted for other languages. add_action('wp_after_admin_bar_render', array($this, 'modifyOptionsGeneralPHPForm')); } } public function updateOptionAdminEmail( $old_value, $value ) { update_option( 'admin_email', $value ); } public function isWordPressMinimiumVersion($version){ global $wp_version; if (version_compare($wp_version, $version, ">=")) { return TRUE; } else { return FALSE; } } //Changes the form on admin area options-general.php. Doesn't do anything unless on this page. public function modifyOptionsGeneralPHPForm(){ $screen = get_current_screen(); if($screen->base == "options-general"){ add_filter( 'gettext', array($this, 'filterText'), 10, 3 ); } } //Changes the English text of WP core. Inspired by https://wordpress.stackexchange.com/questions/188332/override-default-wordpress-core-translation public function filterText( $translated, $original, $domain ) { if ( $translated == "This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>"){ $translated = __("This address is used for admin purposes."); } return $translated; } } 
0
source

You can turn off email confirmation by simply adding the following code to your function.php theme

  remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' ); remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' ); /** * Disable the confirmation notices when an administrator * changes their email address. * * @see http://codex.wordpress.com/Function_Reference/update_option_new_admin_email */ function wpdocs_update_option_new_admin_email( $old_value, $value ) { update_option( 'admin_email', $value ); } add_action( 'add_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 ); add_action( 'update_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 ); 
0
source

The network administrator email address is changed from the wp_sitemeta table. Use the following query in phpmyadmin or any mysql client to update your email if you cannot change the network administrator settings.

 UPDATE 'wp_sitemeta' SET 'meta_value' = ' the_new_email@abc.com ' WHERE 'meta_value' = ' the_old_email@abc.com '; 

Note: please use the table prefix that is used in db, if in your case it is not wp.

look at the image of wp_sitemeata table if you want to know the entries to be changed.

0
source

Source: https://habr.com/ru/post/1274625/


All Articles