函数原型
activate_plugin( string $plugin, string $redirect = ”, bool $network_wide = false, bool $silent = false ): null|WP_Error
函数描述
Attempts activation of plugin in a “sandbox” and redirects on success.
是否弃用
未弃用
函数参数
-
$plugin
string
Required -
Path to the plugin file relative to the plugins directory.
-
$redirect
string
Optional -
URL to redirect to.
Default:
''
-
$network_wide
bool
Optional -
Whether to enable the plugin for all sites in the network or just the current site. Multisite only.
Default:
false
-
$silent
bool
Optional -
Whether to prevent calling activation hooks.
Default:
false
函数返回值
null|WP_Error Null on success, WP_Error on invalid file.
函数位置
File: wp-admin/includes/plugin.php
.
函数源码
The plugin does not have a valid header.
源码链接
变更日志
Version | Description |
---|---|
5.2.0 | Test for WordPress version and PHP version compatibility. |
2.5.0 | Introduced. |