So I have written my first WordPress plugin for production and in the next few days I will be starting up on another project where I might have to write two plugins for the same WP site because they do two distinct set of tasks. Now I was reviewing some of the code I had written for the first plugin I thought it would be great if the two plugins could share some of that code that I had written for the first plugin from my earlier project.

At first I thought maybe I should just write one plugin that does it all but after some pondering I've come to the conclusion that I wanted my plugins to be small and do few tasks rather than having a bloated plugin that does too much. It would be hard to maintain later. So I was wondering if anyone has ever written a code base for that multiple plugins can share and how you accomplished this.

Any relevant links would be appreciated.


Yes, you can easily set up plugins that share a code base. If you make use of global variables and constants, you will be able to read data stored in one plugin by the other. Also, remember that any function registered in one plugin, will be available to all other plugins (unless they're private class functions), as long as the plugin with the function is active.


Take a look at the following plugin frameworks:

You'll likely find some others with a google search string like "wordpress plugin framework".

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.