WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is plugin active

Description

Checks if a plugin is activated.

NOTE: defined in wp-admin/includes/plugin.php, so this is only available from within the admin pages, and any references to this function must be hooked to admin_init or a later action. If you want to use this function from within a template or a must-use plugin, you will need to manually require plugin.php, an example is below.

Usage

In the Admin Area: <?php is_plugin_active($plugin?> In the front end, in a theme, etc... <?php include_once( ABSPATH 'wp-admin/includes/plugin.php' ); ?>
<?php is_plugin_active
($plugin?>

Parameters

$plugin
(string) (required) The name of the plugin sub-directory/file.
Default: None

Return Values

Boolean
true if the plugin is activated, or false if not.

Examples

Admin area <?php
/**
 * Detect plugin. For use in Admin area only.
 */
if ( is_plugin_active'plugin-directory/plugin-file.php' ) ) {
  
//plugin is activated

Front end <?php
/**
 * Detect plugin. For use on Front End only.
 */
include_once( ABSPATH 'wp-admin/includes/plugin.php' );

// check for plugin using plugin name
if ( is_plugin_active'plugin-directory/plugin-file.php' ) ) {
  
//plugin is activated

Change Log

Since Version 2.5

Source File

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

Related

See also index of Function Reference and index of Template Tags.