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. It’s available for both Mac and Windows users.
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 the button to “Create a new site.” Then, all you need to do is choose a few settings.
For each stage of site creation, you can choose to view the Advanced settings or just breeze through with the basics. First you’ll type a site name – you can name it whever you like!
Note: If you dig into those Advanced Option, 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 environment, which includes the PHP version, Web Server, and MySQL version. If you’re a Flywheel customer (or want to be one day!) stick with the Preferred option – that’ll make migrating the local site to Flywheel super smooth. If you’re looking for some other option, go ahead and select the Custom option. This will allow you to custom build your site with whatever environment you need!
Last, there are a few WordPress-specific options to take care of. The basics are to set up your WordPress username and password, which you’ll use to log into the WordPress dashboard. You can also change your WordPress email, which 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!) Last, if you dive into the Advanced Options, you can choose if it’s a WordPress Multisite (and which type).
Once you’re happy with your settings, click “Create New 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 setup process.
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:
- Live Links: 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?
I have been researching that same question. Would like to share my site with other developers on my local network. Can’t find documentation anywhere. The first bullet in the benefits list states this:
“Live Links: Show off your latest work! Create shareable URLs to demo your local WordPress sites to clients, collaborators, friends, or adoring fans.”
I hope to find documentation on that soon.
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.
How can you share with multiple developers on a local network? Running isolated docker?
I’m interested in using Flywheel to start developing locally when I go on travels that force me to be offline. I’m just wondering, how would the process to make the site live work. Do you have an article on that? Could I simple use the duplicator plugin?
Thanks for the answer!
Hey Pato, that’s a great way to use Local by Flywheel! It’s perfect for developing on the road :)
If you’re looking to take the site live on Flywheel, you can simply export a ZIP file of your local site and upload it to our free migration form. Our support team can take it from there!
This sounds like a great option. I am wanting to move my live site with duplicator down to a local version so I can test out some new changes. How would I do this with your software, is it easy to accomplish or is there documentation? I am not setting up a new local site, so the instructions here don’t apply.
Great article Morgan! Definitely editing websites that are currently running ‘live’ is not the best option, especially when you’re maintaining a stable and professional business. During the testing phase of your editing process, your website can go down, or some buttons may not work. That’s why we’ve written an article that covers this same topic on setting up a wordpress dev environment and would love to hear your feedback :) https://goo.gl/smKEzb
When it was first released it did not have the option to export it as a zip file to other hosting providers. Has that changed or are there plans to allow a Flywheel Local site to be uploaded to other web hosts?
Hey Kevin, while we’d love if you chose Flywheel, you can host your Local sites wherever you like! Many users use a backup plugin like Duplicator or BackupBuddy to download the site files. Where you host them after that is totally up to you! :)
need to know which server conditions i need to do an automated plugin update. What is needed on the serverside!? Plz lemme know. Look forward to hear from you ! Greetings Pls write back to [email protected] – thanks in advance!