Filter hook 'new_user_email_content'

in WP Core File wp-includes/user.php at line 3859

View Source

new_user_email_content

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

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Filter
Line Number 3859

Hook Parameters

Type Name Description
string $email_text Text in the email.
array $new_user_email { Data relating to the new user email address.

Usage Examples

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

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

Source Code Context

wp-includes/user.php:3859 - How this hook is used in WordPress core
<?php
3854  		 *
3855  		 *     @type string $hash     The secure hash used in the confirmation link URL.
3856  		 *     @type string $newemail The proposed new email address.
3857  		 * }
3858  		 */
3859  		$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
3860  
3861  		$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
3862  		$content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'profile.php?newuseremail=' . $hash ) ), $content );
3863  		$content = str_replace( '###EMAIL###', $_POST['email'], $content );
3864  		$content = str_replace( '###SITENAME###', $sitename, $content );

PHP Documentation

<?php
/**
		 * Filters the text of the email sent when a change of user 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 new email.
		 * - ###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_user_email {
		 *     Data relating to the new user email address.
		 *
		 *     @type string $hash     The secure hash used in the confirmation link URL.
		 *     @type string $newemail The proposed new email address.
		 * }
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.