WordPress with composer, how to handle updates?

I’m trying to step up my workflow a bit and I’m now trying out Composer to handle WordPress & WordPress plugins.

I have never used Composer before and I’m getting quite confused as to how I’m suppose to update WordPress with this. I know I can just type Composer update after I change the WordPress version in my composer.json file, but that remove my wp.config.php and just reset everything.

I followed some tutorials which demonstrates how to set up WordPress with Composer and separate the core files and the wp-content folder, for a cleaner directory structure. However, I don’t understand how I can update WordPress with Composer if I customized the folder structure, it will just reset on update.

Can someone shed some light on this?

1 Answer
1

Basically in “common” WordPress setup you have two things inside the folder that aren’t part of the core itself: content folder and wp-config.php configuration file.

So you are on completely right path:

  1. You configure content folder to be elsewhere, outside of core folder
  2. You place wp-config.php one directory level above the core folder (WP will look for it there if it’s not present in its root)

That way you have nothing in core folder left, which isn’t safe to delete and overwrite with new core version.

Leave a Comment