WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 } ?>
share|improve this question
Where (what file or hook) do you use this function? – Ján Bočínec Apr 21 '11 at 12:51
up vote 2 down vote accepted

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

share|improve this answer
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

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
share|improve this answer
The poster was unable to use is_plugin_active because it is only available from admin pages. – jeteon Oct 13 '15 at 9:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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