How to Handle Plugin Dependency in WordPress

Photo by Markus Spiske on Unsplash

How WordPress Loads Plugins

Using mu-plugins

Using the plugins_loaded hook

/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_my_awesome_plugin() {
$plugin = new My_Awesome_Plugin();
$plugin->run();
}
run_my_awesome_plugin();
function run_my_awesome_plugin() {$plugin = new My_Awesome_Plugin();
$plugin->run();
}
add_action('plugins_loaded', 'run_my_awesome_plugin');

P.S.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kenn Kitchen

I'm a full-stack developer and the founder/CEO of a company that lets me do what I love (and sometimes get paid for it!)