Using this script you can define a specific WordPress configuration and create multiple websites with the same settings, skipping boring and time consuming manual tasks (WordPress download, setup process, theme and plugins installation...).
The script takes advantage of the [WP-CLI](https://wp-cli.org/) power, creating and running a list of commands witch actually install and configure a full WordPress instance.
- **ensure that your system can run WordPress ([requirements](https://wordpress.org/download/)) and WP-CLI ([requirements](https://wp-cli.org/#installing))**
- carefully read all comments and change the script configuration values to fit your local environment (please check the following [Configuration](#configuration) section).
Most variable names should be self-explanatory, however some of them have a comment on the right.
Check the environment settings first and change them to fit your system. The `$php` variable allows you to select a specific PHP version in case you have multiple versions installed.
To run `wp-install` open a PowerShell window, move to the script folder and run the script using the following parameters:
| Parameter | Mandatory | Description |
|--------------|:---------:|-------------|
|`wpFolderName`| Yes |The name of the folder in which the site will be installed. The name can contain subfolders. The site folder will be created inside the web server root.|
|`wpTitle` | Yes |The site title.|
|`wpUrl` | No |The site url. Extra configuration on the webserver is required for a custom url. If missing, the `$baseUrl` variable will be used (`http://localhost/...` by default).|
|`verboseMode` | No |Print out the commands during the script execution.|
|`testMode` | No |Prevent commands to be run. May be useful together with `verboseMode` to preview the full script execution.|
- Added optional parameter to pass a custom site URL. If not specified, "localhost" will be used. **Please note:** extra configuration on the webserver is required for a custom url.
- Generate a random password for the admin user. The password will be saved to a file in the site folder and also displaed to the terminal. **Please note:** currently the password is not really safe, so change it if you deploy the site.
- Added command to open the site backend at the end of the setup.
**Changed**
- Changed the PHP version used by the script. This is a default value, please modify it according to your environment.
- Modified the default admin username to prevent having an "admin" user, which is not good if the site is going to be deployed.
- Updated the script documentation.
**Fixed**
- Fixed default site url (localhost) when WordPress is installed in a subfolder.
- Removed dots from the folder name, which may cause rewrite rules issues.
- Added commands to update core, plugins and themes language files.
- Added PHP code to enable WordPress debug in the `wp-cli.yml` file.
- Added comments to the PHP code in the `wp-cli.yml` file.
**Changed**
- Moved the lists of plugins and themes to be installed/deleted from the script configuration variables to the `wp-cli.yml` file. Please check the comments in the file for more details.
- Moved the extra-php setting from the script to the YML configuration file. The code can now be added in a easier way and the output will be multiline.