The new_network_admin_email_content WordPress PHP filter allows you to modify the text of the email sent when a change of network admin email address is attempted.
Usage
add_filter('new_network_admin_email_content', 'modify_network_admin_email_content', 10, 2);
function modify_network_admin_email_content($email_text, $new_admin_email) {
// Your custom code here
return $email_text;
}
Parameters
$email_text(string): Text in the email.$new_admin_email(array): Data relating to the new network admin email address.hash(string): The secure hash used in the confirmation link URL.newemail(string): The proposed new network admin email address.
More information
See WordPress Developer Resources: new_network_admin_email_content
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.
Examples
Change email greeting
Customize the email greeting by replacing the default greeting with your own.
add_filter('new_network_admin_email_content', 'change_email_greeting', 10, 2);
function change_email_greeting($email_text, $new_admin_email) {
$email_text = str_replace('Hi', 'Hello', $email_text);
return $email_text;
}
Add a custom signature
Append a custom signature to the email text.
add_filter('new_network_admin_email_content', 'add_custom_signature', 10, 2);
function add_custom_signature($email_text, $new_admin_email) {
$signature = "\n\nBest regards,\nYour Friendly Support Team";
$email_text .= $signature;
return $email_text;
}
Modify the confirmation URL
Replace the default confirmation URL with a custom URL.
add_filter('new_network_admin_email_content', 'modify_confirmation_url', 10, 2);
function modify_confirmation_url($email_text, $new_admin_email) {
$custom_url = 'https://example.com/confirmation';
$email_text = str_replace('###ADMIN_URL###', $custom_url, $email_text);
return $email_text;
}
Add a custom message
Insert a custom message before the confirmation URL.
add_filter('new_network_admin_email_content', 'add_custom_message', 10, 2);
function add_custom_message($email_text, $new_admin_email) {
$message = "\nPlease click the link below to confirm the change:";
$email_text = str_replace('###ADMIN_URL###', $message . "\n\n###ADMIN_URL###", $email_text);
return $email_text;
}
Change email subject
Modify the email subject by hooking into the ‘new_network_admin_email_subject’ filter.
add_filter('new_network_admin_email_subject', 'change_email_subject', 10, 2);
function change_email_subject($email_subject, $new_admin_email) {
$email_subject = 'Confirm Your New Network Admin Email Address';
return $email_subject;
}