Back to Site

Customizing

introduction

In WP Setup we use a file wp-setup.json to load your custom configuration during command executions. This is in fact the main file required to use WP Setup for plugin development. Here you will find how to use this file properly and all the available options.

The json structure

This file can have the following keys:

KeyRequiredDefault
includefalsefalse
multisitefalsefalse
hosttruenone
pluginsfalsenone
themesfalsenone
volumesfalsenone
editorfalsevscode
editorConfigfalsenone
wp.json keys

Include

This key allows you to add a custom docker-compose.yml file to load with ours adding the relative file path from your root directory. It is very useful in different use cases as adding a Redis database to use object cache or any other service needed in your appllication.

Please, reffer to the extending services to see how to extend the docker services from WP Setup.

Multisite

This key allows you to fully setup a WordPress Multisite installation. Only set this key and all will be configured at environment start.

The available options are:

  • subdomain – Start a subdomain installation
  • subdirectory – Start a subdirectory installaton
  • true – Start a subdirectory installation
  • false – Keep as single site

Be aware that after add a multisite option, the only way to make your environment a single site after is destroying the current environment installation.

One important thing to mention is that you cannot use only “localhost” in your host configuration to use as subdomain.

Host

The host address to use in your site. For easy configuration we recommend to use a localhost subdomain as “my-plugin.localhost”. you can pass any valid domain in this field.

In our init command we add this field with the name of your current directory following the recomendation above.

Plugins

An array of plugins to load in your environment. All plugins in this list will be activated at environment start.

The values should follow the pattern “directory:plugin-name” (with the colon mark).

You can use relative paths and zip files URL’s to download external plugins during the start. The example bellow will add your root directory as the root-plugin, the directory ./plugins/other-plugin as the other-plugin and will download the query-monitor plugin from WordPress repository.

"plugins": [
	".:root-plugin",
	"./plugins/other-plugin:other-plugin",
	"https://downloads.wordpress.org/plugin/query-monitor.zip:query-monitor"
],

Themes

This field acts exactly as the plugins field, loading and activating the theme at environment start.

Volumes

This field also works as the plugins field, except that it needs a full directory inside the container and not just plugin/theme directory name. You can use this to add internal directory or files or add non active plugins and themes.

Editor

This field defines the editor to open with the devcontainer commmand. Current only accepts VSCode.

Editor Configuration

This field allows you to configure your editor when using as devcontainer. It expects a object with the editor as key:

{
	"vscode": {
		// Your configuration
	}
}

Please refer to VSCode docs to see how you can use this field to setup extensions and other configurations in your dev container.