How to customize the email template of newly registered user

Copy this code in functions.php of your current theme.

    function custom_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) {
      global $wpcargo;
      /* Get username */
        $user_login = stripslashes( $user->user_login );
        /* Get user passworrd */
        $user_email = stripslashes( $user->user_email );
        /* Get user fullname */
        $user_fullname = $wpcargo->user_fullname($user->ID);
        /* Get phone number */
        $user_phone = $_POST['phone'] ?? '';
        /* Get dashboard url */
        $dashboard_url  =get_the_permalink( wpcfe_admin_page() );
        /* Create body message */
        $message  = sprintf( __( 'Hi, %s' ), $user_fullname )."<br><br>";
        $message .= sprintf( __( "Welcome to %s! Here's how to log in:" ), get_option('blogname') ) . "<br><br>";
        $message .= $dashboard_url . "<br>";
        $message .= sprintf( __('Username: %s'), $user_login ) . "<br>";
        $message .= sprintf( __('Email: %s'), $user_email ) . "<br>";
        $message .= sprintf( __('Phone Number: %s'), $user_phone ) . "<br>";
        $message .= __( 'Password: The one you entered in the registration form. (For security reason, we save encripted password)' ) . "<br><br>";
        $message .= sprintf( __('If you have any problems, please contact me at %s.'), get_option('admin_email') ) . "<br><br>";
      /* Set email Subject */
        $wp_new_user_notification_email['subject'] = sprintf( '[%s] Your credentials.', $blogname );
        /* Set email Content Type */
        $wp_new_user_notification_email['headers'] = array('Content-Type: text/html; charset=UTF-8');
        /* Set email body message */
        $wp_new_user_notification_email['message'] = $message; 
        return $wp_new_user_notification_email;
    }
    add_filter( 'wp_new_user_notification_email', 'custom_wp_new_user_notification_email', 10, 3 );
  
0
    0
    Your Cart
    Your cart is emptyReturn to Shop