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';
  • 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
  • Did you ever figure this out? – codewizard Apr 23 '15 at 15:40
  • I just checked for a class I knew the plugin to have, using class_exists.. – dama_do_bling Apr 23 '15 at 16:32

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

   If (is_plugin_active('plugin-directory/plugin-file.php')) {
     //plugin is activated
  • 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

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.