Im wondering if anyone can point me in the direction of how to create a plugin with add-ons. It looks like the approach is first to create a plugin with the core feature, and then write other plugins that interact with the main plugin. But for some reason its impossible to google, as all my queries brings out plugins from wordpress.org, feather than how-to's and tutorials. So i was hoping someone here could explain or point me in the direction of a guide.


3 Answers 3


You could implement filters and actions in your core plugin's code, at the appropriate places where you want your addons to interact, by using:

do_action( 'my_action');
apply_filters('my_filter', $value, $variable_to_pass, $another_variable_to_pass);

Then you can have addons as separate plugins and have them interact with the core via these hooks by calling:

add_action('my_action', 'action_handle_function'); 
add_filter('my_filter', 'filter_handle_function');

this is how plugins interact with the WordPress core so you are just following in those footsteps.


One thing you can do in an action hooked to register_activation_hook() is to check the active plugins:

$plugins = get_option( 'active_plugins' );

The return value is an Array. So you could activate one plugin, and if the "mother"/parent plugin not is active wp_safe_redirect() and output an action hooked to admin_notice to inform the user to activate the parent plugin first.

If you want to activate the plugin manually, use activate_plugin(). For multisite you might need to take a look at wp_get_active_and_valid_plugins().

Personally I'd avoid trying to fiddle with a users installation and his active plugins. Maybe s/he wouldn't like it to have your plugin changing stuff by itself. And surely it's lot of effort to get this one right. Better stick with notices.


Well, you could build an add-on functionality into your plugin where you can upload a .zip file and unpack that in your plugins folder (like in the core plugin manager). You can save the add-on settings in the database using the Options API.

Maybe you wanna use this: https://codex.wordpress.org/Filesystem_API

  • Links only without any explanation or examples are considered to be low quality.
    – kaiser
    Mar 6, 2014 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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