Share Article To

Yesterday I went through an odd requirement from my client, he wants to modify the message send to new registered user. Actually he wants to send the newly registered user’s activation link by which user can activate their account.

WordPress default functionality is send username and password to the registered user, but my client dont want to set and send any default password. Instead of that he want to activate the new user account using password reset form.

I have confused as in pluggble.php file not providing any action of filter to modify the message.

After googling I understood that we can define the same function in our custom plug-in in if condition to check whether the ‘wp_new_user_notification’ is defined or not.

Below are the code you can write in your custom plug-in and after successfully registration instead of pluggable.php file’s ‘wp_new_user_notification’ function your defined function will execute.
if ( !function_exists('wp_new_user_notification') ) {
function wp_new_user_notification($user_id, $plaintext_pass = '') {
//Create your custom message
$user_email = stripslashes($user->user_email);
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);

Leave a Reply

Your email address will not be published. Required fields are marked *