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

---

# wp_network_admin_email_change_notification( string $option_name, string $new_email, string $old_email, int $network_id )

## In this article

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

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

Sends an email to the old network admin email address when the network admin email
address changes.

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

 `$option_name`stringrequired

The relevant database option name.

`$new_email`stringrequired

The new network admin email address.

`$old_email`stringrequired

The old network admin email address.

`$network_id`intrequired

ID of the network.

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

    ```php
    function wp_network_admin_email_change_notification( $option_name, $new_email, $old_email, $network_id ) {
    	$send = true;

    	// Don't send the notification for an empty email address or the default 'admin_email' value.
    	if ( empty( $old_email ) || 'you@example.com' === $old_email ) {
    		$send = false;
    	}

    	/**
    	 * Filters whether to send the network admin email change notification email.
    	 *
    	 * @since 4.9.0
    	 *
    	 * @param bool   $send       Whether to send the email notification.
    	 * @param string $old_email  The old network admin email address.
    	 * @param string $new_email  The new network admin email address.
    	 * @param int    $network_id ID of the network.
    	 */
    	$send = apply_filters( 'send_network_admin_email_change_email', $send, $old_email, $new_email, $network_id );

    	if ( ! $send ) {
    		return;
    	}

    	/* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */
    	$email_change_text = __(
    		'Hi,

    This notice confirms that the network admin email address was changed on ###SITENAME###.

    The new network admin email address is ###NEW_EMAIL###.

    This email has been sent to ###OLD_EMAIL###

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

    	$email_change_email = array(
    		'to'      => $old_email,
    		/* translators: Network admin email change notification email subject. %s: Network title. */
    		'subject' => __( '[%s] Network Admin Email Changed' ),
    		'message' => $email_change_text,
    		'headers' => '',
    	);
    	// Get network name.
    	$network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES );

    	/**
    	 * Filters the contents of the email notification sent when the network admin email address is changed.
    	 *
    	 * @since 4.9.0
    	 *
    	 * @param array $email_change_email {
    	 *     Used to build wp_mail().
    	 *
    	 *     @type string $to      The intended recipient.
    	 *     @type string $subject The subject of the email.
    	 *     @type string $message The content of the email.
    	 *         The following strings have a special meaning and will get replaced dynamically:
    	 *          - `###OLD_EMAIL###` The old network admin email address.
    	 *          - `###NEW_EMAIL###` The new network admin email address.
    	 *          - `###SITENAME###`  The name of the network.
    	 *          - `###SITEURL###`   The URL to the site.
    	 *     @type string $headers Headers.
    	 * }
    	 * @param string $old_email  The old network admin email address.
    	 * @param string $new_email  The new network admin email address.
    	 * @param int    $network_id ID of the network.
    	 */
    	$email_change_email = apply_filters( 'network_admin_email_change_email', $email_change_email, $old_email, $new_email, $network_id );

    	$email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] );
    	$email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] );
    	$email_change_email['message'] = str_replace( '###SITENAME###', $network_name, $email_change_email['message'] );
    	$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );

    	wp_mail(
    		$email_change_email['to'],
    		sprintf(
    			$email_change_email['subject'],
    			$network_name
    		),
    		$email_change_email['message'],
    		$email_change_email['headers']
    	);
    }
    ```

[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#L2870)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-functions.php#L2870-L2957)

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

 [apply_filters( ‘network_admin_email_change_email’, array $email_change_email, string $old_email, string $new_email, int $network_id )](https://developer.wordpress.org/reference/hooks/network_admin_email_change_email/)

Filters the contents of the email notification sent when the network admin email
address is changed.

 [apply_filters( ‘send_network_admin_email_change_email’, bool $send, string $old_email, string $new_email, int $network_id )](https://developer.wordpress.org/reference/hooks/send_network_admin_email_change_email/)

Filters whether to send the network admin email change notification email.

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

| Uses | Description | 
| [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_mail()](https://developer.wordpress.org/reference/functions/wp_mail/)`wp-includes/pluggable.php` |

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

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

Retrieves the translation of $text.

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

Retrieves the URL for the current site where the front end is accessible.

  | 
| [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.

  |

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

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_network_admin_email_change_notification/?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%2Fwp_network_admin_email_change_notification%2F)
before being able to contribute a note or feedback.