Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
is_plugin_active_for_network() - 判断插件是否在整个网络中处于启用状态 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / is_plugin_active_for_network()

is_plugin_active_for_network( string $plugin )

判断插件是否在整个网络中处于启用状态


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 5 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "16bb87ae60404cee71b47d008c195682" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "c36259426466be41cc8d1020291d7414" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "c30d61148ec8e05b531022c0f59a3830" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "27b80dea11b873a70d5d3314dd01ae5c" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

active

is 条件判断more...

network

plugin 插件more...


描述

只有安装在 plugins/ 文件夹中的插件才能启用。

mu-plugins/ 文件夹中的插件无法“激活”,因此该函数将为这些插件返回false。

更多类似的主题函数信息,请查看主题开发手册中的条件标签文章。


参数

$plugin

(string)(必填) 相对于插件目录的插件文件路径。


返回

(bool) 如果在网络中处于启用状态,则为true,否则为false。


说明

定义此函数的文件(wp-admin/includes/plugin.php)仅加载在后台管理部分。为了使用;is_plugin_active_for_network;在管理页面之外,在尝试使用它之前,有必要引入plugin.php(如示例所示)。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    实例

    // Makes sure the plugin is defined before trying to use it
    if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
        require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
    }
     
    if ( is_plugin_active_for_network( 'plugin-directory/plugin-file.php' ) ) {
        // Plugin is activated
    }