How to Check Whether Core Plugin is Activated Before Allowing Addon Activation

The current trend in plugin development is all about having a core plugin and then developing other addons. But how do you prevent an addon plugin being activated when the core (parent) plugin is not activated?

The way to do that is to check if a particular class, function, or constant from the core plugin exists:

Video SEO for WordPress SEO

Here’s how Yoast does it for his Video SEO for WordPress SEO plugin. The core plugin has a constant WPSEO_VERSION, which stores the current version number of the plugin. The addon plugin then checks for the presence of that constant before it can be used. An elegant solution indeed.

Genesis Connect for Easy Digital Downloads

Here’s a different approach by an addon plugin that relies on both the Genesis theme and the Easy Digital Downloads plugin to be installed, before it can do its job:

TGM Plugin Activation

TGM Plugin Activation is worth a mention because it goes one step further than outputting an admin warning, but actually lets the user install the plugin in a semi-automated fashion. It’s a class that can be bundled with your theme or plugin.

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference pre-packaged plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.

TGM Plugin Activation is available on GitHub.

Do you know of any other methods to achieve this functionality? Let us know in the comments section below!

If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.

About Jean Galea

Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the podcast. His personal blog can be found at

Related Articles

  • How to Check Whether a Plugin is Active

    When creating plugins, I sometimes need to check whether another plugin is already installed and active. This might be due to my plugin adding some extra functionality on top of…

  • Examining the WordPress Core, Plugin and Theme Update Procedure

    A few weeks ago I got curious to examine exactly how WordPress Core, plugins and themes are update. You know the drill from a user point of view. You get…

  • WPTouch Pro Mobile SIte

    WPtouch Pro is one of the most versatile WordPress plugins for converting a website to a mobile site. Customized formatting to selective menu options to integrating your ad service, WPtouch…

Leave a Reply