Developer · Guide
How to Set Up a Local WordPress Dev Environment

Short answer
To set up a local WordPress dev environment, pick wp-env for plugin and theme code, or WordPress Studio or LocalWP for site building with a visual app. Install the tool, create a site, and log in at the local address. Turn on WP_DEBUG in wp-config.php so errors go to a log file while you work.
Key takeaways
- A local environment runs WordPress on your own computer, so mistakes stay private and are fast to undo.
- wp-env needs Docker, Node.js, and git, and its default login is admin with the password password.
- WordPress Studio is a free, open-source app for macOS, Windows, and Linux with sites that start in seconds.
- LocalWP 10.2 and later ships a localwp command line tool that can create and manage sites.
- WP_DEBUG_LOG writes errors to wp-content/debug.log, and WP_DEBUG_DISPLAY set to false hides them from the screen.
What is a local WordPress development environment?
A local WordPress development environment is a copy of WordPress that runs on your own computer, so you can build and test without touching a live site.
It bundles the four parts WordPress needs: a web server, PHP, a database, and the WordPress files. You open the site in your browser at a local address such as localhost:8888, and only you can see it.
Local work is fast to undo. You can break a local site, delete it, and start again in minutes, while the same mistake on a live site would take the site down for visitors.
The WordPress developer docs list the common options in one place. Developer.WordPress.org names wp-env, VVV, XAMPP, MAMP, DDEV, Lando, AMPPS, Bitnami, Instant WordPress, and WordPress Studio as ways to run a development copy (checked November 2026).
Which local environment should you pick?
Pick wp-env for plugin and theme code, WordPress Studio or LocalWP for site building, and a manual stack when you need full control over versions.
Use wp-env when you write plugins or themes and want the same setup as the WordPress core team. It runs from the command line and needs no setup beyond its install steps.
Use WordPress Studio or LocalWP when you want a visual app that creates sites with a few clicks. Both are free desktop apps, and both let you manage several local sites side by side.
Use a manual stack such as XAMPP or MAMP when you need a set PHP or MySQL version that the apps do not offer. A manual stack takes longer to set up, and you manage the server yourself.
| Tool | How you run it | Needs Docker | Best for |
|---|---|---|---|
| wp-env | Command line | Yes, or a no-Docker runtime | Plugin and theme code |
| WordPress Studio | Desktop app | No | Site building and quick tests |
| LocalWP | Desktop app | No | Client sites and staging copies |
| XAMPP or MAMP | Desktop stack | No | Full control over versions |
What do you need before you start?
You need a computer with room for the tool, the matching PHP version, and a clear job for the local site before you install anything.
Check the versions your live host runs, then match them locally. WordPress.org recommends PHP 8.3 or greater, and MariaDB 10.11 or greater or MySQL 8.4 or greater (checked November 2026).
For wp-env, install Docker, Node.js, and git first. Developer.WordPress.org states that wp-env needs those three tools, and that any Docker runtime with the docker CLI and Docker Compose v2 works (checked November 2026).
For a desktop app, download the installer for your system and check that your user account can install apps. WordPress Studio runs on macOS, Windows, and Linux, and LocalWP runs on the same three systems.
A guide on which PHP version to use for WordPress explains how to pick a version that matches your host.
A guide on how to check the PHP version on your host shows where to find the number.
How do you set up wp-env?
Install wp-env from npm, start Docker, then run wp-env start in your project folder to get a local site at localhost:8888.
First, install and start a Docker runtime. Developer.WordPress.org states that Docker Desktop is free for small businesses, personal use, education, and non-commercial open-source projects, and that Colima is a free and open-source option on macOS (checked November 2026).
Next, install wp-env globally with npm:
npm -g install @wordpress/env
Then move into your plugin folder, theme folder, or a new working folder, and start the environment:
wp-env start
When the script finishes, open http://localhost:8888/wp-admin and log in with the username admin and the password password. Developer.WordPress.org gives those exact login details in its getting started guide (checked November 2026).
The database user is root and the database password is password. Developer.WordPress.org lists those credentials on the wp-env reference page (checked November 2026).
wp-env also offers two runtimes that skip Docker. The Playground runtime runs WordPress in WebAssembly, while the PHP runtime uses the PHP on your computer with its built-in web server and a SQLite database. Developer.WordPress.org states that the PHP runtime needs PHP on your PATH with the pdo_sqlite extension (checked November 2026).
| Command | What it does |
|---|---|
| wp-env start | Creates and starts the local site |
| wp-env stop | Stops the site without deleting it |
| wp-env destroy | Deletes the site and its database |
| wp-env reset | Restores the database to how it was right after install |
| wp-env start --update | Restarts after you change local core files |
| wp-env start --runtime=playground | Starts with the WebAssembly runtime |
| wp-env start --runtime=php | Starts with the PHP and SQLite runtime |
How do you set up WordPress Studio?
Download WordPress Studio, open the app, and create a site from the Add site dialog to get a local site in seconds.
WordPress Studio is a free, open-source app for local WordPress sites. WordPress Studio Docs describes it as the local development tool for WordPress, with local sites that start in seconds (checked November 2026).
To install it, visit the official WordPress Studio page and download the installer for your system. WordPress Studio Docs states that the app runs on macOS, Windows, and Linux (checked November 2026).
The first time you open the app, a short setup walks you through the options. WordPress Studio Docs states that the Add site dialog lets you create a new site, start from a Blueprint, connect a WordPress.com or Pressable site, or import a backup (checked November 2026).
WordPress Studio sites support SSL and custom local domains, so the local address can match your production setup. WordPress Studio Docs states that Blueprints bundle plugins, themes, and content so you can reuse the same setup for each new site (checked November 2026).
Built-in tools include a debug log, phpMyAdmin, and Xdebug. WordPress Studio Docs lists those three tools for finding faults in your local site (checked November 2026).
A WordPress.com account is only needed for the connected features. Developer.WordPress.com states that an account is required only if you want to use the preview sites feature (checked November 2026).
How do you set up LocalWP?
Download LocalWP, open the app, and click the plus sign in the lower-left corner to create your first local site.
LocalWP is a free desktop app for local WordPress sites. LocalWP states that you open Local, click the plus sign in the lower-left corner, and fill in your site details to create a new site (checked November 2026).
LocalWP runs on Windows, macOS, and Linux. LocalWP states that Local 10.2 and later includes a command line tool called localwp for those three systems (checked November 2026).
From the command line, you can create a site without opening the app. LocalWP states that the command localwp new followed by a site name creates a new site, after a prompt asks you to approve it (checked November 2026).
localwp new my-test-site
Other commands cover the daily work: localwp start and localwp stop control a site, localwp list shows your sites, and localwp info shows the details of one site. LocalWP lists those commands in its CLI reference (checked November 2026).
How do you set up a manual stack?
Install XAMPP or MAMP, start Apache and MySQL, create a database, then run the WordPress installer in your browser.
A manual stack gives you the server parts as separate pieces. Developer.WordPress.org lists XAMPP as a free and open-source environment from Apache Friends, and MAMP as a free environment with all you need to install WordPress locally (checked November 2026).
Start Apache and MySQL from the stack control panel, then create an empty database for the site. Open the database tool that ships with the stack and add a database with a short name, such as wp_local.
Download WordPress from wordpress.org, unzip it into the stack web folder, and open the site address in your browser. The installer asks for the database name, user, and password, then creates the tables.
Set the PHP version in the stack to match your live host. WordPress.org recommends PHP 8.3 or greater, while older setups still run on PHP 7.4 (checked November 2026).
A manual stack suits developers who already know Apache and MySQL. If you only need a quick site, a desktop app or wp-env gets you there faster.
How do you turn on debugging?
Turn on debugging in wp-config.php by setting WP_DEBUG to true, and send the messages to a log file instead of the screen.
Open wp-config.php in your local site folder and find the WP_DEBUG line. Developer.WordPress.org states that WP_DEBUG is the only debugging constant in a default wp-config.php file, and that it is set to false in a standard install (checked November 2026).
Change the block to this form:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Learn WordPress states that this setup enables debugging, hides errors from the screen, and logs them to the wp-content/debug.log file (checked November 2026).
Read the log after each test. Developer.WordPress.org states that WP_DEBUG_LOG writes errors to a debug.log file in the wp-content folder (checked November 2026).
Never copy these settings to a live site. A live site with WP_DEBUG on can show PHP notices to visitors, which leaks paths and looks broken.
A guide on how to profile WordPress performance with Xdebug covers the next step once the log shows you where the fault sits.
How do you copy a live site down to local?
Copy the live files and database to your computer, point the local copy at its own database, then fix the old URLs to the local address.
Download the live wp-content folder and a database export from the host. Keep the two parts together in one folder on your computer, and keep a copy of the live backup somewhere safe.
Create a local site with the same WordPress version, then replace its wp-content folder and import the database export into the local database. Edit the local wp-config.php so the database name, user, and password match the local setup.
Then replace the live address with the local address in the database, using a search and replace tool that handles serialized data so widget and theme settings stay intact.
Check that the local copy loads and that you can log in. If the login page sends you to the live address, the siteurl and home values in wp_options still hold the old domain.
How do you move local work back to a live site?
Export the local database, upload the changed files, import the database on the host, then replace the local address with the live one.
Move only what changed. If you built a theme or plugin locally, upload just those folders to the live wp-content folder. If you changed content or settings, export the local database and import it on the host.
After the import, run a search and replace on the live database to swap the local address for the live domain. Do a dry run first, and skip the guid column, as the search and replace guide explains.
Clear every cache on the live site after the move, then open the home page and a few key pages. Check that images load and that the admin area opens without errors.
A guide on how to set up a staging site for WordPress explains a safer middle step: test the move on a staging copy before you touch the live site.
What mistakes should you avoid?
Avoid building on a live site, using different PHP versions locally and live, and leaving debugging on after you finish.
Building on a live site means every mistake is public at once. A local copy lets you break things in private and fix them before anyone sees the result.
Different PHP versions hide faults. Code that runs on local PHP 8.3 can fail on a host that runs PHP 7.4, so match the versions before you start.
Leaving WP_DEBUG on in a live wp-config.php shows errors to visitors. Turn it off, or remove the lines, before you move local work to production.
Losing the local database is easy when the site lives only in a tool. Export a backup of the local site before you destroy it or rebuild your computer.
A guide on how to create a WordPress plugin is a good first project for a new local setup, because it needs only a folder, one PHP file, and a header comment.
Frequently asked questions
Is a local WordPress site visible to anyone else?
Yes. A local site runs only on your own computer and is not visible on the internet. Nobody can reach it unless you share a preview link from a tool that offers one, such as WordPress Studio.
Will a local install affect my live site?
No. You install WordPress locally in a separate folder or app, and your live site stays untouched. The two sites share nothing unless you copy files or a database between them.
Which local tool is best for a beginner?
wp-env is best when you write plugins or themes from the command line, while WordPress Studio and LocalWP suit site building with a visual app. All three are free, so pick the one that matches how you like to work.
Which PHP version should my local site run?
Match the PHP version to your live host before you start. WordPress recommends PHP 8.3 or greater, and code that runs on a newer local PHP version can fail on an older host version.
Can I copy my live site down to work on it locally?
Yes, and it is the normal way to work. Copy the live files and database down, replace the live address with the local one, and test in private. Move only the changed files and database back when the work is done.
Sources
- Get started with wp-env WordPress Developer Resources
- @wordpress/env package reference WordPress Developer Resources
- Running a Development Copy of WordPress WordPress Developer Resources
- WordPress Studio Docs WordPress Studio Docs
- WordPress Studio WordPress Developer
- Local CLI LocalWP
- Debugging in WordPress WordPress Developer Resources
- Requirements WordPress.org
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


