I am using wordpress 5.3.x. and I am using "fabpot/goutte": "^4.0" in my composer in one of my wordpress plugin. In my theme I am using "fabpot/goutte": "^3.8". Both are using require_once 'vendor/autoload.php'; to autoload the composer defined libraries.

It seems that my plugin is using the version from "fabpot/goutte": "^3.8", and not the version that is within my plugins directory. The reason might be that my themes are loaded first, and then my plugins are loaded by wordpress.

I want to create my plugins standalone. How can I solve this interference?

I appreciate your replies!

  • "It seems" - can you actually verify that?
    – kero
    Commented Jan 15, 2020 at 16:42
  • 1
    Is updating fabpot/goutte in the theme to the latest version not an option?
    – Tom J Nowell
    Commented Jan 15, 2020 at 17:58

1 Answer 1


Your analysis of the problem is absolutely right. By having separate autoloaders in the theme and plugin you'll run into conflicts and only the first one being loaded.

There is no easy and general solution to this, but if you control the whole stack the best solution probably is to put the whole site including WP under composer management and define the plugin and the theme as dependencies. Then Composer can look for a version that satisfies all requirements or warns you with an error if there is an unsolvable conflict.

The one thing you can't have is running multiple versions simultaneously.

If you want to dig deeper this article gives a great overview of the issue: https://inpsyde.com/en/package-management-in-wordpress-introduction-solutions

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.