通知站点管理员设置已完成。

原型

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

描述

向网站设置完成的新管理员发送带有wp_mail的电子邮件,并向他们提供其登录凭据的记录。

参数

$blog_title (string) (Required) 网站标题。

$blog_url (string) (Required) 网站网址。

$user_id (int) (Required) 用户身份。

$password (string) (Required) 用户密码

源文件

路径:wp-admin/includes/upgrade.php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
...
function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
	$user = new WP_User( $user_id );
	$email = $user->user_email;
	$name = $user->user_login;
	$login_url = wp_login_url();
	/* translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL */
	$message = sprintf( __( "Your new WordPress site has been successfully set up at:

%1\$s

You can log in to the administrator account with the following information:

Username: %2\$s
Password: %3\$s
Log in here: %4\$s

We hope you enjoy your new site. Thanks!

--The WordPress Team
https://wordpress.org/
"), $blog_url, $name, $password, $login_url );

	@wp_mail($email, __('New WordPress Site'), $message);
}

...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_new_blog_notification/