Update plugins via Composer

Running composer install in the Wordpress root, causes to update autoload of some plugins and change plugins file require paths.
But running composer install command outside of Wordpress root directory, will solve this issue. But in your websites documentations, only mentions putting composer.json in the Wordpress root
All I need is to know is it possible to put composer.json outside of WP root?

  • Huberson
    • Recruit

    Hello Frontkom
    It might be possible to add the composer.json outside the WordPress root folder but will probably have to modify the default composer autoload.

    What you can try is, manually add the required modules inside composer.json and add in a new 'autoload' field. For example:

        "autoload": {
            "psr-4": { "somenamespaceifany\\": ["pathtoclasses1/", "pathtoclasses2/"] }

    Basically, "somenamespaceifany" is for any namespace you might be using in your plugins, and the "pathtoclasses#" are directories where the default autoloader should start looking for your classes.

    Then run composer update command instead of install.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.