before_populate_network
云策文档标注
概述
before_populate_network 是一个 WordPress Hook,在填充网络设置之前触发,允许开发者在网络初始化过程中执行自定义操作。
关键要点
- 触发时机:在 populate_network() 函数执行前,用于网络设置的初始化阶段。
- 参数:包括 $network_id(网络ID)、$domain(域名)、$email(管理员邮箱)、$site_name(网络名称)、$path(路径)和 $subdomain_install(子域名安装标志)。
- 用途:常用于修改网络设置或添加自定义逻辑,如验证或日志记录。
- 相关函数:与 populate_network() 关联,定义在 wp-admin/includes/schema.php 中。
- 版本历史:从 WordPress 6.9.0 版本引入。
代码示例
do_action( 'before_populate_network', $network_id, $domain, $email, $site_name, $path, $subdomain_install );
原文内容
Fires before a network is populated.
Parameters
$network_idint-
ID of network to populate.
$domainstring-
The domain name for the network.
$emailstring-
Email address for the network administrator.
$site_namestring-
The name of the network.
$pathstring-
The path to append to the network’s domain name.
$subdomain_installbool-
Whether the network is a subdomain installation or a subdirectory installation.
Source
do_action( 'before_populate_network', $network_id, $domain, $email, $site_name, $path, $subdomain_install );
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |