Advertisement
fauzanjeg

Create custom message for new users

Oct 11th, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. /* Create custom message for new users */
  2. function custom_email_for_news_user( $wp_new_user_notification_email, $user, $blogname ) {
  3.     $key = get_password_reset_key( $user );
  4.  
  5.     /* translators: %s: User login. */
  6.     $custom_message  = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
  7.     $custom_message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n";
  8.     $custom_message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n";
  9.  
  10.     $custom_message .= home_url() . "\r\n";
  11.  
  12.     $wp_new_user_notification_email['message'] = $custom_message;
  13.  
  14.     return $wp_new_user_notification_email;
  15. }
  16. add_filter( 'wp_new_user_notification_email', 'custom_email_for_news_user', 99, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement