Title: update_network_option_new_admin_email
Published: November 20, 2017
Last modified: May 20, 2026

---

# update_network_option_new_admin_email( string $old_value, string $value )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#wp--skip-link--target)

Sends a confirmation request email when a change of network admin email address 
is attempted.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#description)󠁿

The new network admin address will not become active until confirmed.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#parameters)󠁿

 `$old_value`stringrequired

The old network admin email address.

`$value`stringrequired

The proposed new network admin email address.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#source)󠁿

    ```php
    function update_network_option_new_admin_email( $old_value, $value ) {
    	if ( get_site_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
    		return;
    	}

    	$hash            = md5( $value . time() . mt_rand() );
    	$new_admin_email = array(
    		'hash'     => $hash,
    		'newemail' => $value,
    	);
    	update_site_option( 'network_admin_hash', $new_admin_email );

    	$switched_locale = switch_to_user_locale( get_current_user_id() );

    	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
    	$email_text = __(
    		'Howdy ###USERNAME###,

    You recently requested to have the network admin email address on
    your network changed.

    If this is correct, please click on the following link to change it:
    ###ADMIN_URL###

    You can safely ignore and delete this email if you do not want to
    take this action.

    This email has been sent to ###EMAIL###

    Regards,
    All at ###SITENAME###
    ###SITEURL###'
    	);

    	/**
    	 * Filters the text of the email sent when a change of network admin email address is attempted.
    	 *
    	 * The following strings have a special meaning and will get replaced dynamically:
    	 *
    	 *  - `###USERNAME###`  The current user's username.
    	 *  - `###ADMIN_URL###` The link to click on to confirm the email change.
    	 *  - `###EMAIL###`     The proposed new network admin email address.
    	 *  - `###SITENAME###`  The name of the network.
    	 *  - `###SITEURL###`   The URL to the network.
    	 *
    	 * @since 4.9.0
    	 *
    	 * @param string $email_text      Text in the email.
    	 * @param array  $new_admin_email {
    	 *     Data relating to the new network admin email address.
    	 *
    	 *     @type string $hash     The secure hash used in the confirmation link URL.
    	 *     @type string $newemail The proposed new network admin email address.
    	 * }
    	 */
    	$content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email );

    	$current_user = wp_get_current_user();
    	$content      = str_replace( '###USERNAME###', $current_user->user_login, $content );
    	$content      = str_replace( '###ADMIN_URL###', esc_url( network_admin_url( 'settings.php?network_admin_hash=' . $hash ) ), $content );
    	$content      = str_replace( '###EMAIL###', $value, $content );
    	$content      = str_replace( '###SITENAME###', wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES ), $content );
    	$content      = str_replace( '###SITEURL###', network_home_url(), $content );

    	wp_mail(
    		$value,
    		sprintf(
    			/* translators: Email change notification email subject. %s: Network title. */
    			__( '[%s] Network Admin Email Change Request' ),
    			wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES )
    		),
    		$content
    	);

    	if ( $switched_locale ) {
    		restore_previous_locale();
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ms-functions.php#L2781)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-functions.php#L2781-L2858)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#hooks)󠁿

 [apply_filters( ‘new_network_admin_email_content’, string $email_text, array $new_admin_email )](https://developer.wordpress.org/reference/hooks/new_network_admin_email_content/)

Filters the text of the email sent when a change of network admin email address 
is attempted.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#related)󠁿

| Uses | Description | 
| [switch_to_user_locale()](https://developer.wordpress.org/reference/functions/switch_to_user_locale/)`wp-includes/l10n.php` |

Switches the translations according to the given user’s locale.

  | 
| [restore_previous_locale()](https://developer.wordpress.org/reference/functions/restore_previous_locale/)`wp-includes/l10n.php` |

Restores the translations according to the previous locale.

  | 
| [is_email()](https://developer.wordpress.org/reference/functions/is_email/)`wp-includes/formatting.php` |

Verifies that an email is valid.

  | 
| [wp_specialchars_decode()](https://developer.wordpress.org/reference/functions/wp_specialchars_decode/)`wp-includes/formatting.php` |

Converts a number of HTML entities into their special characters.

  | 
| [wp_get_current_user()](https://developer.wordpress.org/reference/functions/wp_get_current_user/)`wp-includes/pluggable.php` |

Retrieves the current user object.

  | 
| [wp_mail()](https://developer.wordpress.org/reference/functions/wp_mail/)`wp-includes/pluggable.php` |

Sends an email, similar to PHP’s mail function.

  | 
| [network_admin_url()](https://developer.wordpress.org/reference/functions/network_admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for the network.

  | 
| [network_home_url()](https://developer.wordpress.org/reference/functions/network_home_url/)`wp-includes/link-template.php` |

Retrieves the home URL for the current network.

  | 
| [update_site_option()](https://developer.wordpress.org/reference/functions/update_site_option/)`wp-includes/option.php` |

Updates the value of an option that was already added for the current network.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [get_site_option()](https://developer.wordpress.org/reference/functions/get_site_option/)`wp-includes/option.php` |

Retrieve an option value for the current network based on name of option.

  | 
| [get_current_user_id()](https://developer.wordpress.org/reference/functions/get_current_user_id/)`wp-includes/user.php` |

Gets the current user’s ID.

  |

[Show 9 more](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/update_network_option_new_admin_email/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fupdate_network_option_new_admin_email%2F)
before being able to contribute a note or feedback.