## # Structuring a WordPress Composer project
Before continuing, it's good to talk about the structure of the WordPress project. So far, the **default location** of our WordPress folder is directly in the root. We'll want to move it to another directory which we'll call **public**. The benefit is that we can hide **private or sensitive** information outside of the public folder, which cannot be accessed via a url. We also want to separate the **wp-content** folder and code unique to the project from the WordPress core.

Here's the project structure: ```yml root |-- composer.json |-- composer.lock |-- public |-- wordpress # From John P Bloch's project |-- wp-content |-- themes # Mixture of repository themes and loaded via composer |-- plugins # Mixture of repository plugins and loaded via composer |-- uploads # Uploads folder, ignored by the repository (via .gitignore) |-- vendor # Composer packages folder ``` So how will we achieve this?

#### Change the default WordPress directory All we have to do is add the following to the Composer file: ``` > composer.json ``` ```json { "extra": { "wordpress-install-dir": "public/wordpress" } } ``` > Note: The WordPress installer Composer by John P Bloch allows WordPress packages to be installed outside the vendor folder. It allows allows for custom directories also.

To install it again, run: ``` $ composer update ```

#### Delete the old WordPress directory You'll now find WordPress in the **public/wordpress** folder. You'll also find the old folder is still there directory in the route which should be removed: ``` $ rm -rf wordpress # You may have to use sudo privileges ```

### Add the theme, upload and plugin folders ``` $ mkdir public/wp-content \ && mkdir public/wp-content/themes \ && mkdir public/wp-content/uploads \ && mkdir public/wp-content/plugins ``` > **Note:** To preserve the folder structure in Git whilst empty, just add a **.gitkeep** file to each folder.