2

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?

1 Answer 1

3

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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