I found many examples where the user registration e-mail had the link with the self-generated password. Basically I would like to customize (add more text) on default user notification, link here:

https://developer.wordpress.org/reference/functions/wp_new_user_notification/ Is important to me to let users choose their password on registration email. the commented code is not working, is an idea of I want to achieve. The rest of code is working.

// Redefine user notification function
add_filter( 'wp_new_user_notification_email' ,'edit_user_notification_email', 10, 3 );

function edit_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) {

$message = __( "Welcome to my site! ) . "\r\n\r\n";
$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
$message .= __('To set your password click here:') . "\r\n\r\n";
/* $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n"; */
$message .= __('Then click here to log in') . "\r\n\r\n";
$message .= sprintf(('https://example.com/login')) . "\r\n\r\n";
$message .= __(' ') . "\r\n\r\n";

$wp_new_user_notification_email['message'] = $message;

return $wp_new_user_notification_email;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.