Prevent redundant WordPress plugin code – location of shared code files

Solution:

WordPress kind of sucks with reusability in plugins. As far as I know, there isn’t any integrated way to reuse code in WordPress plugins.

You can try out Plugin Dependencies plugin to manage dependencies between your plugins. So you can store your generic code under one plugin that will be required by others.

Other approach would be using WordPress hooks/actions system. So you will have to defer your plugin init until the library plugin hook executes.

There are activation/deactivation hooks, so you can do some stuff when the framework is missing.

Take a look a these pages: