WordPress walkthrough
End-to-end: from lerd install to a WordPress site running on https://myblog.test with MySQL.
Prerequisites
You've already run lerd install once on this machine. If not, see Installation.
Drive it from your AI assistant
Run lerd mcp:enable-global once and your AI assistant (Claude Code, Junie, Windsurf) can call every command below as an MCP tool: site_link, env_setup, setup, db_create, site_tls, etc. See AI Integration.
1. Register the WordPress framework definition (one-time)
Save this as ~/.config/lerd/frameworks/wordpress.yaml:
# ~/.config/lerd/frameworks/wordpress.yaml
name: wordpress
label: WordPress
detect:
- file: wp-login.php
- file: wp-config.php
public_dir: .
env:
fallback_file: wp-config.php
fallback_format: php-const
composer: false
npm: falseThen register it:
lerd framework add wordpress --from-file ~/.config/lerd/frameworks/wordpress.yamlWhy no .env?
WordPress stores configuration in wp-config.php as PHP constants, not in a .env file. The fallback_file / fallback_format settings tell lerd to read constants like DB_HOST, WP_HOME, and WP_SITEURL directly from wp-config.php. This means lerd env doesn't auto-inject database credentials the way it does for Laravel or Symfony; you'll wire them up by hand in step 5.
2. Download WordPress
cd ~/Lerd
wp core download --path=myblogcd ~/Lerd
mkdir myblog && cd myblog
curl -O https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz --strip-components=1
rm latest.tar.gz3. Register the site
cd ~/Lerd/myblog
lerd linklerd link detects WordPress (via wp-login.php or wp-config.php), assigns http://myblog.test, and serves from the project root.
4. Configure PHP and start MySQL
lerd init? PHP version: 8.3
? Node version (leave blank to skip):
? Enable HTTPS? Yes
? Services: [mysql]
Saved .lerd.yamlWorkers are not shown; the WordPress framework definition declares none.
5. Create the database
lerd db:create myblogThis creates myblog and myblog_testing inside the lerd-mysql container.
Database credentials
| Setting | Value |
|---|---|
| Host | lerd-mysql |
| Port | 3306 |
| User | root |
| Password | lerd |
| Database | myblog |
These come from the lerd built-in MySQL service. See Services.
6. Configure wp-config.php
Run the WordPress installer (browser at http://myblog.test) which will prompt for the values above, or copy wp-config-sample.php and edit it manually:
cp wp-config-sample.php wp-config.phpThen edit the DB_* constants:
define( 'DB_NAME', 'myblog' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'lerd' );
define( 'DB_HOST', 'lerd-mysql' );Generate fresh authentication salts (the installer does this automatically; for the manual path, replace the placeholder block with output from https://api.wordpress.org/secret-key/1.1/salt/).
7. Enable HTTPS
lerd secure myblogThis issues a trusted local cert via mkcert and switches the vhost to HTTPS. WordPress also stores its canonical URL in two places, so update them too:
// wp-config.php
define( 'WP_HOME', 'https://myblog.test' );
define( 'WP_SITEURL', 'https://myblog.test' );(Or update the same values in Settings > General from the WordPress admin.)
8. Open it
lerd openWalk through the five-minute install (admin user, site title, password). When you're done, https://myblog.test/wp-admin is your dashboard.
9. Verify
lerd statusmyblog should be listed as active and mysql as running. Live nginx and PHP-FPM logs are in the Web UI at http://127.0.0.1:7073.
What just happened
| Command | What it did |
|---|---|
lerd framework add wordpress | Registered the YAML so WordPress projects are auto-detected |
lerd link | Assigned myblog.test, set document root to project root |
lerd init | Wrote .lerd.yaml with PHP 8.3 and the MySQL service |
lerd db:create myblog | Created myblog and myblog_testing inside lerd-mysql |
(manual) wp-config.php edits | Pointed WordPress at lerd-mysql and the new database |
lerd secure myblog | Issued mkcert TLS, switched vhost to HTTPS |
Next steps
- Frameworks & Workers: extend
wordpress.yamlto add log paths or custom workers (e.g.wp cron event run) - Database:
lerd db:importto load a production dump,lerd db:shellfor quick queries - Services: add a Mailpit service to capture outgoing mail in dev
- HTTPS: wildcard certs for multi-site or git worktrees
- AI Integration (MCP): drive lerd from Claude Code, Cursor, Junie, etc.