How to set up a local WordPress development environment
When you’re building out a WordPress site, it can be tempting to start making changes whenever and wherever you want, right on the live site. One little CSS tweak to the button styles won’t hurt anything, right?
Even simple changes can be risky, however, which is why a certain golden rule of WordPress development exists: When you’re developing WordPress sites, even if you’re just making a minor code change, you should never, ever make changes directly on a live site.
Whether you’re a seasoned WordPress pro or a brand new beginner, you’ve probably heard this rule once or twice, and for good reason. One wrong line of code can bring the entire thing crashing down (queue a frustrating white screen), and then you’re stuck at square one.
That’s why it’s much smarter and safer to develop WordPress sites locally on your machine.
What is a local development environment?
The key word here is “local.” With a local development environment, you can set up a server on your own machine and store your site’s files locally, instead of externally (such as through a hosting company). This means that you can tinker with the code to your heart’s desire, because nothing is actually live – it’s just on your personal machine. A local development environment eliminates the risk of breaking a production site while giving you a super speedy way to test changes.
While a local development site isn’t actually live, it looks live in your browser. Because the files are stored locally on your machine, the browser has everything it needs to render the site, and even allow you into the WordPress admin to make changes. This also means that you don’t need WiFi to work on your site. That’s right – with a local development environment, you can work on WordPress sites anywhere, anytime, as long as you have your machine. And because the files are all stored locally, any changes you make will update instantly. There’s no need to mess with SFTP and wait for servers to communicate; it all just updates automatically, allowing you to work quickly and efficiently.
If you’re building WordPress sites, using a local development environment is a best-practice solution for developing customizations or simply testing out new themes or plugins (both of which should never be done on a production site). Now, let’s get your environment set up!
How to set up a local WordPress environment with Local by Flywheel
In the past, setting up a local WordPress environment was kind of a pain, but today it’s easier than ever thanks to Local by Flywheel. It’s a fuss-free (and cost-free) local development app that will improve your workflow and make it a total breeze to develop WordPress sites from anywhere in the world. Let’s get it set up!
1. Download and install Local by Flywheel
To get started, download Local by Flywheel. There’s the free version, and if you’re interested, you can sign up for the beta version of Local Pro.
A quick note: Local is currently only available for Mac OS X, but don’t worry, a Windows version is coming soon! Sign up here to get updates.
Once you download the ZIP file, open it to install Local by Flywheel on your machine.
2. Set up Local by Flywheel
The first time you open Local by Flywheel, it has to do just a hair of set up to spin up the local servers.
Don’t worry, this doesn’t take too long. You’ll be up and running in no time!
3. Spin up your first site
Now the fun begins! To whip up your first local WordPress site, click “Add Site.” Then, all you need to do is choose a few settings.
As you type a Site Name, you’ll notice the “Site Domain” box automatically generates based on the name. If you want to change that, feel free to directly edit the Site Domain text.
Note: We recommend keeping the
.dev ending of the Site Domain, as it tells your computer to open that site with an internal IP address. Totally optional, though!
Next you’ll choose the Site Path, where all of the files will live on your machine. You can stick with the default, or choose a specific path, depending on your preference.
Once that’s all set, it’s to decide what versions you’d like your site to run on. When you click “Environment,” you can choose the PHP Version, Web Server, and MySQL Version. This is incredibly helpful for testing different set ups with different plugins and themes, and seeing how everything works together.
Last, there are a few WordPress specific options. You can choose if it’s a WordPress Multisite (and which type), and then you’ll create the WordPress Admin Username and Password (which you’ll use to log into the WordPress dashboard.) The very last option, Admin E-Mail, is mostly for testing purposes, but you’re welcome to use a real email address if you’d like. (We recommend inserting a real one if you plan to take the site live!)
Once you’re happy with your settings, click “Add Site.” Local by Flywheel will then spin up a separate server on your machine for your site to locally live on. This takes just a moment, as it has to configure the server and the database. Then, you’re set!
4. Start testing and experimenting
Once your site is all set up, you’ll see the site dashboard where you can make changes or experiment with your site.
Want to see your local WordPress site? Simply click the “View Site” button. It’ll open a new tab in your browser with your local WordPress site.
Ready to jump into the WordPress dashboard? You can either add in the good old
/wp-admin onto the URL (just like any live WordPress site) or you can click the “Admin” button from the Local by Flywheel site dashboard. Then enter the same WordPress Admin Username and Password you declared during the set up.
If you’re ready to do some DIY customizations in a child theme, you can easily access your local site files by clicking the arrow next to the Path Name. This will open a Finder window, allowing you to quickly navigate to whatever file you’re searching for.
And that’s it – with Local by Flywheel, it’s seriously that easy to spin up local WordPress sites and start developing!
The benefits of using Local by Flywheel for WordPress development
We’ve mentioned a few of the benefits of local WordPress development (such as a secure way to experiment with WordPress sites) but Local by Flywheel takes the brownie points a few steps further:
- Simple demo URLs: Show off your latest work! Create shareable URLs to demo your local WordPress sites to clients, collaborators, friends, or adoring fans.
- Hassle-free local SSL support: Any site created via Local by Flywheel will automatically have a self-signed certificate created. Green padlock achieved.
- SSH / WP-CLI access: Local by Flywheel offers simple root SSH access to individual sites, so you can tinker around if your heart desires.
- Flexible environment options: Hot-swap between NGINX or Apache 2.4, or switch between PHP versions. Everything will stay up and running!
We think local WordPress development is so important to a designer’s workflow, and we are so excited to present Local by Flywheel as a fuss-free way to spin up local WordPress sites quickly and easily. Our super-simple application makes spinning up local WordPress sites a breeze so you can focus on building, not fixing.
Wow. To offer this–and for free? Terrific! Set up was a breeze. I used to use ServerPress, but this is super sweet and will be a vital part of my workflow. Thanks, Flywheel! You guys rock the casbah!
Hi, This is very, very cool! Just wondering how it works to go from local to Flywheel hosting? Thanks!!
For now, you can export a ZIP file of your local site and upload it to our free migration form to move a site onto Flywheel. We’ll be releasing some super simple updates soon though, so be sure to sign up for updates!
You guys rock! I’m also currently using ServerPress but my subscription ran out and I’m super excited to try this.
So, I’m hoping for sweet deployment options straight into flywheel with pro? ;)
Happy to hear that, James! We’ve definitely got some big plans up our sleeves. Stay tuned! :)
Will you have a feature coming out for pulling in a live flywheel site to a local installation?
You bet! Flywheel integration is definitely on the roadmap :)
Thanks so much for this—it looks amazing! I’ll be giving it a try ASAP.
Hope all is well!
All the best,
Thanks David! We’re pretty excited about it, too. Can’t wait to hear what you think once you’ve tried it out! :)
Absolutely amazing! Speechless on how easy this app is to use. Thank you Flywheel!
As soon as I read the news over at WP Tavern, I just had to try it out.
As the others above have said already, it is super easy to spin up a new site and to access it via SSH and Adminer.
I had never heard of Mailcatcher and I think it is great as is the usefulness of adding SSL and a live demo URL!
Simply awesome that you offer this free of charge, thank you Flywheel!
Tried downloading it and spinning up a site… resulting in: ‘Error: WordPress installation failed’. Re-installed WordPress and now can’t connect to the database, with Adminer, Sequel Pro or through the WordPress config set-up. No docs, nothing back from support on the community forum. Hummm.
Hey Fred, sorry about the trouble. Looks like a member of our team replied to your question in the community forum this morning. They’ll be able to help you get to the bottom of this!
Mac only, so I won’t ever use your products.
Don’t worry James, a Windows version is coming very, very soon! Stay tuned :)
How do I generate a shareable URL?
Hi there, wonderful article!
I’m having troubles with my admin password – it’s not a typo issue.
Please advise and thanks!
Am I able to import a WP site created locally in say MAMP, into Local by Flywheel?
I’m attempting to host our site locally, using the files downloaded from Flywheels Back-up download. After adding the site, local by flywheel is stuck at the ‘installing WordPress’. Does this indicate the the backup does not include all the files I need to launch the site on local?
Hey Noelle – sorry it’s giving you some trouble! Sounds like you might’ve found a bug. If you head over to the Local Community, you can report this to the developers and follow along with updates.
can I upload the ZIP.file as well to another hostservice or is only flywheel suporting these files?
Hey Ro, they should work with any host! Your provider should be able to help you out with any specifics about the files.