Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a plugin activated and working, and I installed and activated another plugin I wrote to communicate with it. However when I run is_plugin_active() I get false returned - does anyone have any idea why and how to rectify it?

EDIT: some basic code. I am in the admin area, and I'm trying to use the functions of the other plugin ultimately. But the initial check is quite basic:

if (is_plugin_active('Plugin2')) {
    echo 'Thanks for installing Plugin2';
} else {
    echo 'Please install Plugin2';
}

EDIT2: Per the codex, you do NOT need the filepath if you're using in the admin side. But I tried with the full path, as modified here, which also did not work.

if (is_plugin_active('Plugin2/Plugin2.php')) {
    echo 'Thanks for installing Plugin2';
} else {
    echo 'Please install Plugin2';
}
share|improve this question
2  
Can you post some code or give some context as to how/where you are using it? –  Stephen Harris Mar 6 '12 at 18:59
    
Is this example code the actual code you're using? Because if it is, then your code won't work ... as cale_b answered below, you need the plugin directory and file name (with .php extension) for this to work correctly. –  EAMann Mar 6 '12 at 19:15
    
Is Plugin2 the actual slug of the Plugin, or is it an "example" Plugin slug? Also: in what directory is Plugin2 installed? –  Chip Bennett Mar 6 '12 at 19:29

1 Answer 1

Per the WP Codex, you need to be sure you are passing the directory and file:

<?php
   If (is_plugin_active('plugin-directory/plugin-file.php')) {
     //plugin is activated
  }
?> 
share|improve this answer
    
Not working, and I'm the admin area anyway so it shouldn't matter. –  dama_do_bling Mar 6 '12 at 19:08
    
Per your question above, it doesn't appear you are passing the file name.... –  cale_b Mar 6 '12 at 19:15

Your Answer

 
discard

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.