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'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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

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

 
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.