wp_new_blog_notification

Notifies the site admin that the setup is complete.

Description

wp_new_blog_notification( (string) $blog_title, (string) $blog_url, (int) $user_id, (string) $password ); 

Sends an email with wp_mail to the new administrator that the site setup is complete, and provides them with a record of their login credentials.

Parameters (4)

0. $blog_title (string)
The blog title.
1. $blog_url (string)
The blog url.
2. $user_id (int)
The user id.
3. $password (string)
User's Password.

Usage

  1. if ( !function_exists( 'wp_new_blog_notification' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/upgrade.php'; 
  3.  
  4. // The blog title. 
  5. $blog_title = ''; 
  6.  
  7. // The blog url. 
  8. $blog_url = ''; 
  9.  
  10. // The user id. 
  11. $user_id = -1; 
  12.  
  13. // User's Password. 
  14. $password = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wp_new_blog_notification($blog_title, $blog_url, $user_id, $password); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/upgrade.php  
  1. function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) { 
  2. $user = new WP_User( $user_id ); 
  3. $email = $user->user_email; 
  4. $name = $user->user_login; 
  5. $login_url = wp_login_url(); 
  6. /** translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL */ 
  7. $message = sprintf( __( "Your new WordPress site has been successfully set up at: 
  8.  
  9. %1\$s 
  10.  
  11. You can log in to the administrator account with the following information: 
  12.  
  13. Username: %2\$s 
  14. Password: %3\$s 
  15. Log in here: %4\$s 
  16.  
  17. We hope you enjoy your new site. Thanks! 
  18.  
  19. --The WordPress Team 
  20. https://wordpress.org/ 
  21. "), $blog_url, $name, $password, $login_url ); 
  22.  
  23. @wp_mail($email, __('New WordPress Site'), $message);