email_change_email
Filter HookDescription
Filters the contents of the email sent when the user's email is changed. The following strings have a special meaning and will get replaced dynamically: - ###USERNAME### The current user's username. - ###ADMIN_EMAIL### The admin email in case this was unexpected. - ###NEW_EMAIL### The new email address. - ###EMAIL### The old email address. - ###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 | 2830 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$email_change_email
|
{ Used to build wp_mail(). |
array
|
$user
|
The original user array. |
array
|
$userdata
|
The updated user array. |
Usage Examples
Basic Usage
<?php
// Hook into email_change_email
add_filter('email_change_email', 'my_custom_filter', 10, 3);
function my_custom_filter($email_change_email, $user, $userdata) {
// Your custom filtering logic here
return $email_change_email;
}
Source Code Context
wp-includes/user.php:2830
- How this hook is used in WordPress core
<?php
2825 * @type string $headers Headers.
2826 * }
2827 * @param array $user The original user array.
2828 * @param array $userdata The updated user array.
2829 */
2830 $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );
2831
2832 $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] );
2833 $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] );
2834 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] );
2835 $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] );
PHP Documentation
<?php
/**
* Filters the contents of the email sent when the user's email is changed.
*
* @since 4.3.0
*
* @param array $email_change_email {
* Used to build wp_mail().
*
* @type string $to The intended recipients.
* @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:
* - ###USERNAME### The current user's username.
* - ###ADMIN_EMAIL### The admin email in case this was unexpected.
* - ###NEW_EMAIL### The new email address.
* - ###EMAIL### The old email address.
* - ###SITENAME### The name of the site.
* - ###SITEURL### The URL to the site.
* @type string $headers Headers.
* }
* @param array $user The original user array.
* @param array $userdata The updated user array.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.