apply_filters( 'wp_new_user_notification_email', array $wp_new_user_notification_email, WP_User $user, string $blogname )

Filters the contents of the new user notification email sent to the new user.


Description Description


Parameters Parameters

$wp_new_user_notification_email

(array) Used to build wp_mail().

  • 'to'
    (string) The intended recipient - New user email address.
  • 'subject'
    (string) The subject of the email.
  • 'message'
    (string) The body of the email.
  • 'headers'
    (string) The headers of the email.

$user

(WP_User) User object for new user.

$blogname

(string) The site title.


Top ↑

Source Source

File: wp-includes/pluggable.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.9.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Jim

    Actually I found a function that does it pretty painlessly – parse_str – takes the variables out of a URLfunction fp_wp_new_user_notification_email( $array, $user, $blogname ) { parse_str( $array[‘message’] ); . . . And now my function contains all the variables in the URL, including $key, with the same names!

  2. Skip to note 2 content
    Contributed by Abdul Wahab
    
    /**
     * Filter the new user notification email.
     *
     * @param $email array New user notification email parameters.
     * @return $email array New user notification email parameters.
     */
    function myplugin_new_user_notification_email_callback( $email ) {
    	$email['message'] .= "\r\n" . __( 'Thank you for register on site.', 'textdomain' );
    	return $email;
    }
    
    add_filter( 'wp_new_user_notification_email', 'myplugin_new_user_notification_email_callback' );
    
    

You must log in before being able to contribute a note or feedback.