I'm using the mingle plugin and the mingle-forum plugin.

I want to show a certain part on my site only if those two plugins are active. How can I solve this?

<?php if ( is_plugin_active('mingle-forum') ) { ?>
                    <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div>
                <?php } ?>

This throws a php error. Call to undefined function is_plugin_active

Any idea what I'm doing wrong?


<?php if ( plugin_active('plugin-directory/mingle-forum/wpf-main.php') ) { ?>
                    <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div>
                <?php } ?>
  • Where (what file or hook) do you use this function? Commented Apr 21, 2011 at 12:51

5 Answers 5


This function exists in wp-admin/includes/plugin.php so I'm assuming it doesn't get included by the theme.

You can either require it, or just create your own version of it - see here: http://wordpress.org/support/topic/is_plugin_active


Please check is_plugin_active

  • thank you, i might have found a solution but I still can't get it working. The function plugin_active is set in my functions.php file and doesn't through an error. However my div.login does NEVER show up, doesn't matter if the plugin is active or not. Maybe I'm checking for the wrong path? Any idea what I could do wrong here? Commented Apr 22, 2011 at 7:41
  • 1
    found the solution. "plugin-directory" of course has to be the name of the directory where the actual plugin file is in. I thought "plugin-directory" is the path to the dir where all the plugin files are in. Commented Apr 22, 2011 at 7:43
  • exactly mathiregster, that's what everyone seems to be missing here. plugin-directory is most likely going to be the name of your plugin Commented Sep 15, 2021 at 14:20

There are two way by which you can check plugin is active or not.

  1. You can use is_plugin_active function to check plugin active or not.
  2. If plugin have class then you can check like below-

    if (class_exists('YITH_Woocompare_Frontend')) 
    echo 'your code';

The above class related to YITH WooCommerce Compare plugin . The above code check if class exist then only you code inside the bracket will execute.

  • was about to upvote, but the class thing is just totally false. What happens if the class name is changed? and is_plugin_active is basically the accepted answer :( Commented Aug 3, 2016 at 6:50

You can also try to check plugin is Active or Not

$pluginList = get_option( 'active_plugins' );
$plugin = 'PLUGIN_DIR/FILE_NAME.php'; 
if ( in_array( $plugin , $pluginList ) ) {
    // Plugin 'mg-post-contributors' is Active

Also try below code for simplicity

if ( is_plugin_active( 'PLUGIN_DIR/FILE_NAME.php' ) ) {
  //plugin is activated
  • The poster was unable to use is_plugin_active because it is only available from admin pages.
    – jeteon
    Commented Oct 13, 2015 at 9:06
  • This solution helped me verify the plugin name. Tks
    – Memonic
    Commented Apr 23, 2020 at 16:02

You can simply use the WordPress default function. This function exists in wp-admin/includes/plugin.php.

Simply pass the Path to the plugin file relative to the plugins directory.

$pluginPath = 'akismet/akismet.php';
if ( is_plugin_active( $pluginPath ) ) {
    echo 'Plugin is activated';
} else {
   echo 'Plugin is not activated';

For more details on is_plugin_active please see the below link:


  • Thank you, @Sohel Khan; that hint was really useful to me; I use/d it to start building a health bar for my site :) Cheers!
    – eLeXeM
    Commented Nov 14, 2020 at 18:03

the correct and actual way to check if a plugin is active or not is to set a

function_exists ()

function for your code

  • 2
    Welcome to wpse! the correct and actual way to check if a plugin is active or not is to set function_exists. What if a plugin is OO and doesn't use any functions, only methods, your answer fails to address this situation. Commented Oct 14, 2021 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.