title | nav_order |
---|---|
Configuration |
4 |
{: .no_toc }
{: .no_toc .text-delta }
- TOC {:toc}
WP Starter can work without any setup at all, however one of its greatest features is its flexibility that allows for fine-grained customization of every aspect according to the project requirements.
Like other Composer plugins, WP Starter configuration goes into extra
section of composer.json
.
More specifically, it goes into a sub-object wpstarter
in the extra
section.
{
"extra": {
"wpstarter": {
"config-name": "config value"
}
}
}
For better readability and portability it is also possible to have a file named wpstarter.json
, placed besides composer.json
, that contains only WP Starter configuration (anything that would go in the extra.wpstarter
object):
{
"config-name": "config value"
}
WP Starter will recognize the file and will load configuration from there, without the need to have anything set in composer.json
or anywhere else.
Instead of using a file named wpstarter.json
in root folder it is also possible to tell WP Starter to use a different file to load configuration.
A use case could be to reuse the same WP Starter configuration for many websites that resides under the same parent folder.
To do this, in composer.json
it is necessary to use the extra.wpstarter
configuration to set the path of the custom file. The path must be relative to the folder containing the composer.json
:
{
"extra": {
"wpstarter": "../wpstarter-shared-config.json"
}
}
This also enables to have the configuration file available in a custom Composer package and make it available to WP Starter by pointing to the file in vendor folder:
{
"extra": {
"wpstarter": "./vendor/my-company/wp-starter-shared/config.json"
}
}
The values in wpstarter.json
takes precedence when composer.json
contains an extra.wpstarter
section (regardless if as an object or as a path to a custom file) with duplicate values to the wpstarter.json
.
There are two configuration values that affect WP Starter that cannot be placed inside the extra.wpstarter
object, nor can they be set in wpstarter.json
:
"wordpress-install-dir"
"wordpress-content-dir"
These two configuration values might contain a custom path where to place, respectively, WordPress core files and WordPress "content packages": plugin, themes, MU plugins, and dropins.
"wordpress-install-dir"
is not even a WP Starter specific configuration, but it comes from the WordPress core installer. Regardless of whether the Wordpress core installer is used, this configuration is required to tell WP Starter where WordPress core files are located.
This configuration defaults to "./wordpress"
meaning a wordpress
folder inside project root.
"wordpress-content-dir"
has been introduced by WP Starter and it is located differently from other WP Starter settings to be in symmetry with "wordpress-install-dir"
.
This configuration defaults to "./wp-content"
meaning a wp-content
folder inside project root.
Next: WP Starter Steps