WordPress local development with Short Leash

On this page

Short Leash serves WordPress and Bedrock sites at https://<name>.test as soon as their folder is parked or linked, with the PHP version and MySQL database you choose.

How does Short Leash recognize WordPress?

A folder with wp-config.php or wp-load.php is served as WordPress from the folder itself. A Bedrock project (web/wp/wp-load.php or web/wp-config.php) is served from web/. Requests that don't match a file go to index.php, so pretty permalinks work without any rewrite rules.

How do I connect WordPress to a database?

Add a MySQL service on the Services screen, then create a database for the site with your database app (Open in opens it). In wp-config.php:

define('DB_NAME', 'my_site');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', '127.0.0.1:3306');

For Bedrock, Add to site writes DATABASE_URL into the project's .env, which Bedrock reads.

How do I catch the mail WordPress sends?

WordPress sends mail with PHP's mail() by default, which Short Leash doesn't intercept. Install an SMTP plugin and point it at 127.0.0.1, port 2525, with no encryption. Use the site's name as the user name to give it its own inbox. Messages appear on the Mail screen. See Mail.

Does multisite work?

Subdomain multisite works: every name under <name>.test, such as blog.<name>.test, reaches the same site. Subdirectory multisite works too, because Short Leash sends unknown paths to index.php.

Can I use WP-CLI?

Yes. Install WP-CLI as you normally would. With Short Leash's php on your PATH (see Terminal), it runs on the PHP version the site uses.