While there is not an official way to create child plugins, the topic has been discussed in the WordPress community over the past few years. I caught up with Ian Dunn who submitted the idea three years ago to see if it still has merit.
From an architectural standpoint, creating a child plugin isn’t really practical. It works for themes because they have a very specific, defined set of behaviors, but plugins are completely different.
Ian recently published a post highlighting the right way to customize plugins. The first suggestion he offered is to get in touch with the plugin author and let them know what changes you’d like to see.
If that doesn’t work, the next step is to extend the plugin without modifying its core. The easiest way to accomplish this is to create a functionality plugin that will run alongside it. You can take things one step further by using Plugin Dependencies by Scribu to control when the functionality plugin is activated. Plugin Dependencies allow you to specify if a parent plugin is deactivated, it will also deactivate the plugin dependent upon it.
Hooks are a way for one piece of code to interact with and modify another piece of code. If the plugin you want to modify offers hooks, you can use them to extend the plugins functionality. According to Ian, if the developer added hooks, you just need to write a separate plugin that runs alongside the plugin you’re customizing and register callbacks for the custom hooks that the plugin provides.
Code Snippets by Shea Bunge is an easy way to manage code snippets to extend plugins. Code Snippets is cool because it adds a GUI to create and manage code snippets. The snippets are executed as if they are located within the themes functions.php file. This added benefit alleviates the possibility of functions.php filling up with hundreds of lines of extra code. Using Code Snippets to extend plugins instead of functions.php prevents the changes from being lost when a user switches themes.
The mantra of never editing core WordPress files should be observed for plugins and themes. The goal is to extend or remove functionality without having those changes disappear after an upgrade. It’s frowned upon to place code snippets within a theme’s functions.php file. Instead, use a functionality plugin or use the Code Snippets plugin to manage them. Plugin authors are encouraged to add hooks where they’ll make the most impact. If you’re unsure on how to add custom hooks to your plugin, there is a great explanation available within the plugin developer handbook.