is_plugin_active_for_network()判断某个插件是否激活正在使用

目录

描述

Checks to see if a plugin is "Network Active" on a multi-site installation of WordPress.

is_plugin_active_for_network() 描述

用法

<?php is_plugin_active_for_network($plugin?>

is_plugin_active_for_network() 用法

参数

$plugin

(string) (必填) The name of the plugin sub-directory/file.

默认值: None

is_plugin_active_for_network() 参数

返回值

True

if plugin is network active, else false.

is_plugin_active_for_network() 返回值

示例


<?php
// 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
}
?>

is_plugin_active_for_network() 示例

注意

The file that defines this function (wp-admin/includes/plugin.php) is only loaded in the admin sections. In order to use is_plugin_active_for_network outside the admin pages, it's necessary to include or require plugin.php before trying to use it (as shown in the example).

is_plugin_active_for_network() 注意

历史

源文件

is_plugin_active_for_network() is defined in wp-admin/includes/plugin.php.

is_plugin_active_for_network() 源文件

相关