I like to create child plugin..

Explanation :-

I have one parent plugin named X. This will work independently (like other existing plugins).

Now I decided to add some extra features to that plugin X (think of it as an upgrade). So I want to create extra features by way of another plugin Y, which will depend on (and inherit from) X.
This plugin Y will not work with out plugin X.

How can I do this?

3 Answers 3


the Best way to do this is have your X plugin made with its own hooks for actions and filters so new plugins (in your case Y) could interact with plugin X's functions and data. Defining your own hooks is fairly easy and simple.

Action Hook

from the codex:

Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.

example of a new action hook:

Function whatever(){
   //regular stuff you do normally 
  do_action('Name-Of-Your-Action-hook', $args1,$args2)
  //regular stuff you do normally

Now we can interact with that function and use its arguments ($args1,$args2) using 'Name-Of-Your_hook' hook


Filter Hook

from the codex:

Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.

example of a new filter hook:

Function whatever(){
   //regular stuff you do normally 
   $output = apply_filters('Name-Of-Your-Filter-hook', $output,$args1,$args2)
  //regular stuff you do normally

Now we can interact with that function , filter $output use and its arguments ($args1,$args2) using 'Name-Of-Your-Filter-hook' hook


A good example to that would be contact form 7

  • Contact Form 7 - Campaign Monitor Addon
  • Contact Form 7 Dynamic Text Extension
  • Contact Form 7 Calendar
  • Contact Form 7 Textarea Wordcount
  • Contact Form 7 Customfield in mail
  • Contact Form 7 to Database Extension

and many more which all (most) are plugins that extend the functionality of Contact Form 7 based on its hooks.

  • Thank you. This is a very detailed and well written solution. My only thoughts are that you could use a clearer name for Function whatever() ... still a great answer, THANK YOU Commented Oct 2, 2015 at 15:21

Make some hooks in your parent plugin to which the child plugin can attach their own function. Also wrap the child plugin in if(function_exists('parent-plugin-function')) or class_exists if its a class.

  • 2
    I don't think this is a good solution, since the whole reason one would like to have a child plugin rather than modify the original plugin is so that you don't have to modify the original (or "parent") plugin. Hooks in the parent plugin for extensibility are nice, but the asker's solution could not rely on them. (...as I and many others are surely in the same boat.) Commented Oct 2, 2015 at 15:20
  • @Metagrapher OP indicates that he wants to be able to create child plugin of plugin, so it was more of how to architect things so that a plugin is capable of being extensible via child plugins.
    – Ashfame
    Commented Aug 19, 2016 at 16:06

I just went through myself and I had so many changes that I couldn't just override the actions.

I created this tool that allows you to create a child plugin like a child theme. You can make updates to the plugin and still update it without losing your changes.

I'm posting this here because it relates and hopefully becomes useful to the next person who runs into this issue.


  • I found this is useful by need to make sure is this still working. it was developed 3 years ago and we are at now WordPress 6.3 version.
    – Harsha
    Commented Aug 18, 2023 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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