You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering different behaviors with composer install and composer update regarding wordpress themes and plugins.
I want to import custom themes and plugins into wordpress, so I added them through the composer path directive.
I'm not fully sure if this is a composer issue, an issue with your great project, or just me not doing things properly.
However the files are only copied into wordpress/wp-content/themes (or /plugins) when I run composer update or composer install with no composer.lock file present.
This behavior can be reproduced locally.
Here's what I noticed:
When I delete the composer.lock file + wordpress folder + vendor folder and run composer install, it works as expected, my plugin and theme are installed.
If I now keep the composer.lock file that I’ve got in step 1., delete wordpress folder and vendor folder and run composer install again, my plugins and themes are NOT installed (despite the logs saying otherwise).
If I do a diff of the composer.lock files of the lock files generated in step 1 and in step 2 there is absolutely no difference between them (besides the hash).
➜ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 25 installs, 0 updates, 0 removals
- Installing composer/installers (v1.9.0): Loading from cache
- Installing johnpbloch/wordpress-core-installer (2.0.0): Loading from cache
- Installing me/my_custom_plugin (1.0): Mirroring from custom/plugins/my_custom_plugin
- Installing me/my_custom_theme (1.0): Mirroring from custom/themes/my_custom_theme
...
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
> cp wp-config.php wordpress/
But when I check if the theme is present:
ls -la wordpress/wp-content/themes
.rw-r--r-- 28 trolologuy 11 Jun 0:05 index.php
drwxr-xr-x - trolologuy 11 Jun 0:05 twentynineteen
drwxr-xr-x - trolologuy 11 Jun 0:05 twentyseventeen
drwxr-xr-x - trolologuy 11 Jun 0:05 twentytwenty
The text was updated successfully, but these errors were encountered:
Okey finally after coming across this issue, I noticed that indeed the install order in composer was different between the tests when the composer.lock was present or not.
What ultimately fixed it was to change the composer.json files in my templates and plugins to add the johnpbloch/wordpress-core package as required, to force installation AFTER wordpress is installed.
Thanks for stopping by! I'm glad to hear that you've got it working for now. I personally would be worried about what happens when core updates, though. As I explained in the thread you found in the wordpress-core repository, these packages are not meant to support the standard WordPress installation of keeping wp-content inside ABSPATH.
The only way I know of to reliably use these packages in a standard WP installation setup is to base the install off of johnpbloch/wordpress-core at the beginning using composer create-project and then using wp-cli instead of composer to keep WordPress core updated.
Hello,
I'm encountering different behaviors with
composer install
andcomposer update
regarding wordpress themes and plugins.I want to import custom themes and plugins into wordpress, so I added them through the composer path directive.
I'm not fully sure if this is a composer issue, an issue with your great project, or just me not doing things properly.
Here's the folder structure:
Both my custom theme and plugin use a
composer.json
that has the following structure:However the files are only copied into
wordpress/wp-content/themes
(or/plugins
) when I runcomposer update
orcomposer install
with nocomposer.lock
file present.This behavior can be reproduced locally.
Here's what I noticed:
composer.lock
file +wordpress
folder +vendor
folder and runcomposer install
, it works as expected, my plugin and theme are installed.composer.lock
file that I’ve got in step 1., deletewordpress
folder andvendor
folder and runcomposer install
again, my plugins and themes are NOT installed (despite the logs saying otherwise).If I do a diff of the
composer.lock
files of the lock files generated in step 1 and in step 2 there is absolutely no difference between them (besides the hash).What brings me to the conclusion that somehow the
**commands seem to be ignored.
Is this a known issue? Or expected behavior?**
Here's my main
composer.json
fileHere's an example (with a present lock file):
But when I check if the theme is present:
The text was updated successfully, but these errors were encountered: