How to check if certain plugin exists and in expected version

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

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.

Leave a Comment