I have a few plugins and intend to move them to a very common base with an abstract class. The issue is that even if I apply solutions in order to avoid class duplications ( like EarnestoDev's answer for #31034 ) the system could end up with different versions of the abstract class if more of my plugins are present.

In order to avoid this I should update all my plugins when the abstract class is updated, but that seems to be an overkill.

Is there any other way to include classes only for a specific plugin rather than using namespaces?

1 Answer 1


Unfortunately there is no system in WordPress to handle dependencies and sharing components between extensions is a challenge.

The possible solutions roughly are:

  • make shared part a plugin and require each plugin to require it (and possibly auto install/activate)
  • implement loader that will take care of processing versioning for shared part and take care of loading latest version available (see scbFramework for one example of such)

If extensions are for private use (as opposed to being separately and publicly available) you can manage them as part of whole site stack - in version control or Composer (which I hope will get more traction for WP projects).

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.