WordPress at a glance

is_plugin_active() WP 1.0

Check whether a plugin is active.

Only plugins installed in the plugins/ folder can be active.

Plugins in the mu-plugins/ folder can't be "activated," so this function will return false for those plugins.

✈ 1 time = 0.000043s = very fast | 50000 times = 0.63s = very fast PHP 7.0.14, WP 4.7

No Hooks.

Return

true/false. True, if in the active plugins list. False, not in the list.

Usage

is_plugin_active( $plugin );
$plugin(string) (required)
Path to the main plugin file from plugins directory.

Code of is_plugin_active: wp-admin/includes/plugin.php VER 4.9.8

<?php
function is_plugin_active( $plugin ) {
	return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
}

Related Functions

From tag: plugin

More from tag: Conditional tags (all)

More from category: Plugins, Hooks

No comments
    Hello, !     Log In . Register