首页 WordPress函数大全 activate_plugin()

activate_plugin()

2020-05-02 / 2370阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

activate_plugin( string $plugin, string $redirect = '', bool $network_wide = false, bool $silent = false )

尝试激活“沙盒”中的插件并重定向>

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

已经激活的插件将不会尝试再次激活。

它的工作方式是在尝试包含插件文件之前,将重定向设置为错误。如果插件失败,那么重定向将不会被成功消息覆盖。同样,这些选项将不会更新,并且不会调用激活挂钩>

参数

$plugin

(string)
(Required)
Path to the plugin file relative to the plugins directory.

$redirect

(string)
(Optional)
URL to redirect to.

Default value: ''

$network_wide

(bool)
(Optional)
Whether to enable the plugin for all sites in the network or just the current site. Multisite>Default value: false

$silent

(bool)
(Optional)
Whether to prevent calling activation hooks.

Default value: false

返回

(null|WP_Error) Null>WP_Error on invalid file.

大家谈论
    我的见解