I've created plugin that goes to wordpress plugin repositories. Now, I need to create another plugin (sub plugin or child plugin you may call) that require this certain plugin to be already installed and activated.

I know I can use register_activation_hook. However, how do I check using that hook? Or, maybe there's another solution exists?


There is is_plugin_active() function.

Other method is to check if functions or classes, specific to required plugin, exist. Some plugins explicitly define their own constants for this, typically with version number and/or other identifying info.

There has been some developments to make extension dependence logic more generic, such as Plugin Dependecies, but they hadn't gained widespread adoption so far.

  • 1
    You may also need to add the require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); before you can use is_plugin_active() – Nickiler Jan 15 '12 at 9:43
  • Hey @rarst, the link doesn't work any more. Is there any updated version of the link? – Mahmudur Mar 18 '13 at 4:03
  • @Mahmudur plugin had changed a lot since, so no newer example from it... – Rarst Mar 18 '13 at 10:31

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.