Filter hook 'new_admin_email_content'

in WP Core File wp-admin/includes/misc.php at line 1503

View Source

new_admin_email_content

Filter Hook
Description
Filters the text of the email sent when a change of site 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 site admin email address. - ###SITENAME### The name of the site. - ###SITEURL### The URL to the site. }

Hook Information

File Location wp-admin/includes/misc.php View on GitHub
Hook Type Filter
Line Number 1503

Hook Parameters

Type Name Description
string $email_text Text in the email.
array $new_admin_email { Data relating to the new site admin email address.

Usage Examples

Basic Usage
<?php
// Hook into new_admin_email_content
add_filter('new_admin_email_content', 'my_custom_filter', 10, 2);

function my_custom_filter($email_text, $new_admin_email) {
    // Your custom filtering logic here
    return $email_text;
}

Source Code Context

wp-admin/includes/misc.php:1503 - How this hook is used in WordPress core
<?php
1498  	 *
1499  	 *     @type string $hash     The secure hash used in the confirmation link URL.
1500  	 *     @type string $newemail The proposed new site admin email address.
1501  	 * }
1502  	 */
1503  	$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
1504  
1505  	$current_user = wp_get_current_user();
1506  	$content      = str_replace( '###USERNAME###', $current_user->user_login, $content );
1507  	$content      = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content );
1508  	$content      = str_replace( '###EMAIL###', $value, $content );

PHP Documentation

<?php
/**
	 * Filters the text of the email sent when a change of site 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 site admin email address.
	 *  - ###SITENAME###  The name of the site.
	 *  - ###SITEURL###   The URL to the site.
	 *
	 * @since MU (3.0.0)
	 * @since 4.9.0 This filter is no longer Multisite specific.
	 *
	 * @param string $email_text      Text in the email.
	 * @param array  $new_admin_email {
	 *     Data relating to the new site admin email address.
	 *
	 *     @type string $hash     The secure hash used in the confirmation link URL.
	 *     @type string $newemail The proposed new site admin email address.
	 * }
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/misc.php
Related Hooks

Related hooks will be displayed here in future updates.