Filter hook 'retrieve_password_message'

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

View Source

retrieve_password_message

Filter Hook
Description
Filters the message body of the password reset mail. If the filtered message is empty, the password reset email will not be sent.

Hook Information

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

Hook Parameters

Type Name Description
string $message Email message.
string $key The activation key.
string $user_login The username for the user.
WP_User $user_data WP_User object.

Usage Examples

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

function my_custom_filter($message, $key, $user_login, $user_data) {
    // Your custom filtering logic here
    return $message;
}

Source Code Context

wp-includes/user.php:3344 - How this hook is used in WordPress core
<?php
3339  	 * @param string  $message    Email message.
3340  	 * @param string  $key        The activation key.
3341  	 * @param string  $user_login The username for the user.
3342  	 * @param WP_User $user_data  WP_User object.
3343  	 */
3344  	$message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
3345  
3346  	// Short-circuit on falsey $message value for backwards compatibility.
3347  	if ( ! $message ) {
3348  		return true;
3349  	}

PHP Documentation

<?php
/**
	 * Filters the message body of the password reset mail.
	 *
	 * If the filtered message is empty, the password reset email will not be sent.
	 *
	 * @since 2.8.0
	 * @since 4.1.0 Added `$user_login` and `$user_data` parameters.
	 *
	 * @param string  $message    Email message.
	 * @param string  $key        The activation key.
	 * @param string  $user_login The username for the user.
	 * @param WP_User $user_data  WP_User object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.