3.7 KiB
Easy WordPress Bootstrap (Windows + Herd)
PowerShell companion to the macOS bootstrap script. It provisions a full WordPress development site backed by Laravel Herd and DBngin (or any local MySQL/MariaDB server) with a single command.
Included Files
wp-bootstrap.ps1– main PowerShell script.wp-cli.phar– bundled WP-CLI used by the script whenwpis not installed globally.plugins.json– default plugin manifest; copy/override per project if you need a different set.
Prerequisites
- Windows 10/11 with PowerShell 7 (
pwsh) recommended. - Laravel Herd for Windows installed so PHP is available (the script auto-detects Herd’s
php.exe). - DBngin or another MySQL/MariaDB server running locally, with
mysql.exeavailable inPATH. - Git for cloning the starter theme.
- Composer and npm in
PATHso theme dependencies can be installed and built (the script warns and skips if they are missing).
First-Time Setup
-
Allow local PowerShell scripts (only needs to be done once for your profile):
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -
Copy the sample rc file and adjust values that should become your defaults:
Copy-Item ..\wp-bootstraprc.example $HOME\.wp-bootstraprc -
Leave
wp-cli.pharin the same folder aswp-bootstrap.ps1(or update theWP_CLI_PHARentry in your rc file to point elsewhere).
Running a Bootstrap
From this directory, run:
pwsh -File .\wp-bootstrap.ps1 -ProjectName "Client Site"
Optional parameters (all may also be supplied via ~\.wp-bootstraprc):
-AdminUser-AdminEmail-ThemeStarterRepo-HerdWorkspace-LocalTld-MysqlHost-MysqlPort-MysqlRootUser-MysqlRootPass
Omit parameters to fall back to your rc defaults. The script prints the detected configuration before it runs and exits early if required inputs are still missing.
What the Script Does
- Creates a sanitized project folder in your Herd workspace and reports the local URL.
- Validates MySQL root credentials, creates the database/user, and confirms the new user can connect.
- Downloads WordPress core, generates
wp-config.php, shuffles salts, sets permalinks, creates Home/News pages, and assigns them. - Ensures a standard
.htaccessexists for Apache-friendly rewrites. - Clones the starter theme with shallow history, strips
.git, reinitializes the repo, sets an optional remote, and activates the theme. - Installs/activates plugins pulled from
plugins.json, preferring a project-local manifest when present. - Runs
composer install,npm install, andnpm run buildinside the theme when those tools are available. - Writes a
bootstrap-summary.txtto the project root and logs plugin installs towp-content/plugin-bootstrap.log.
Plugin Manifest Details
plugins.json entries can be WordPress.org slugs or zip URLs (including private artifacts). Place a tailored plugins.json in your project directory to override the repository default for a single site.
Troubleshooting
- WP-CLI – ensure
wp-cli.pharlives beside the script or setWP_CLI_PHARin~\.wp-bootstraprcto an absolute path. - MySQL connectivity – verify the server is running, your root user matches the rc values, and Windows Firewall allows the connection.
- Composer/NPM missing – install them via Scoop/winget/Homebrew on Windows, or remove their commands from the script if you do not build theme assets.
- Permissions – confirm Herd has access to the project folder and that the execution policy change succeeded.
DIY-first policy: keep plugins.json lean; add heavier stacks only when the project truly needs them.