Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Created December 18, 2025 07:08
Show Gist options
  • Select an option

  • Save aimahdi/95744be950e9949474c606ba7639be91 to your computer and use it in GitHub Desktop.

Select an option

Save aimahdi/95744be950e9949474c606ba7639be91 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'wp_new_user_notification_email', function ( $email, $user, $blogname ) {
$reset_link = wp_lostpassword_url();
$email['subject'] = sprintf(
'Welcome to %s – Set your password',
$blogname
);
$email['message'] = sprintf(
"Hi %s,\n\n".
"Thanks for your purchase! We've created your account on %s.\n\n".
"To access your account and manage your profile, please set your password using the link below:\n\n".
"%s\n\n".
"If you didn’t request this, you can safely ignore this email.\n\n".
"Best regards,\n".
"%s Team",
$user->display_name ?: $user->user_login,
$blogname,
$reset_link,
$blogname
);
return $email;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment