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? – Ján Bočínec Apr 21 '11 at 12:51

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 reference

  • 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? – mathiregister Apr 22 '11 at 7:41
  • 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. – mathiregister Apr 22 '11 at 7:43

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 :( – Mark Kaplun Aug 3 '16 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 Oct 13 '15 at 9:06

You can simply use the WordPress default function. This function exists in


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";
    echo "Plugin is not activated";

For more detail please see the below link. https://developer.wordpress.org/reference/functions/is_plugin_active/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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