Summary :
This guide explains how to install and run WordPress locally using the .wp-env.json configuration file. You’ll learn how to set up your environment, add plugins and themes, and manage everything using just a few commands. Perfect for developers who want a fast, consistent, and code-driven WordPress setup without manual installation.
Introduction:
There are many ways to install WordPress for local development, and one of the easiest and most efficient methods is using .wp-env.json. This configuration file is part of the official WordPress development tools and allows you to set up a complete WordPress environment with just a few commands.
With .wp-env.json, you don’t need to manually install PHP, MySQL, or WordPress. It defines your project setup such as themes, plugins, and settings, and automatically creates a local environment for you. This makes it perfect for developers who want a quick and consistent setup for building or testing themes and plugins.
In this blog, you’ll learn how to install and run WordPress using .wp-env.json, from creating your project folder to configuring the environment, adding plugins and themes, and accessing your local site.
What is .wp-env.json and Why It’s Useful
The .wp-env.json file is a configuration file used by the WordPress Environment Tool (wp-env), which helps developers quickly spin up WordPress installations for local testing and development.
This file tells wp-env how to set up and manage your environment, including what version of WordPress to use, which plugins or themes to load, and which port to run on.
Why it’s useful:
- No manual setup required: Automatically installs and configures WordPress.
- Quick testing: Ideal for plugin and theme development in an isolated sandbox.
- Consistent environment: Ensures every team member works on the same setup.
- Easy cleanup: You can remove the environment anytime without affecting your main system.
How to Install WordPress Using .wp-env.json
Step 1: Create a Project Folder
Open your terminal and create a new directory for your WordPress project:
mkdir mandy-env
cd mandy-env/

Step2: Initialize Node Project
npm init

Step3: Install @wordpress/env Package
npm i -D @wordpress/env

Step4: Add a .wp-env.json file to configure the WordPress
{
"core":null,
"phpVersion":null
}
Step5: Add “wp-env” command to package.json scripts
Open your package.json and add this line under the scripts section:
"scripts": {
"wp-env":"wp-env"
},
Then you can run:
npm run wp-env start
Step 6: Build and start the Docker container
npm run wp-env start

Accessing WordPress
- Frontend (Site) → http://localhost:8888/
- Admin Dashboard → http://localhost:8888/wp-admin
- Username : admin
- Password : password


Adding Plugins and Themes
{
"core":null,
"phpVersion":null,
"plugins": [
"Wordpress/classic-editor",
"Wordpress/wp-lazy-loading"
],
"themes" : [
"Wordpress/twentytwentyfive"
]
}
After editing the file, restart your environment to apply the changes:
npm run wp-env start --update

View Installed Plugins and Themes

Connecting the Database via Sequel Pro (or another SQL Client)
If you want to view or modify your local WordPress database:
- Open Sequel Pro (or your preferred SQL editor)
- Use these details for your connection:
| Name | mysql-db-connection |
| Host | 127.0.0.1 |
| Port | mysql-port-number (Example : 58557) |
| Username | your-db-username |
| Password | password |
| Database | your-database-name (or leave blank — Sequel Pro will list databases |


Essential wp-env CLI Commands :
Starts the WordPress environment:
npx wp-env start
Stops all running containers:
npx wp-env stop
Removes the environment completely
npx wp-env destroy
Opens WP-CLI inside the container
npx wp-env run cli
Removes all cached files
npx wp-env clean
Final Thoughts :
Using .wp-env.json is one of the fastest and most reliable ways to set up WordPress for local development. It eliminates manual configurations, keeps your environment consistent, and simplifies testing for plugins and themes.
Whether you’re building custom WordPress solutions or contributing to open-source projects, .wp-env.json gives you a clean, isolated setup that’s easy to start, stop, and reset. With just a few commands, you can create a fully functional WordPress environment — ready for coding, testing, and innovation.
If you need help setting up or customizing your WordPress environment, feel free to connect with us — we’d be happy to help you get started!



