The ultimate guide to set up a local WordPress development environment
Using a local WordPress development environment is an efficient way to design and develop websites on your own machine. This method offers a vast amount of advantages over cowboy coding (editing live servers) and it’s free to implement, as long as you’re using the right tools.
If you’re new to developing websites or just used to editing live, using a local WordPress development environment can be a pretty new concept. That’s why we’ve developed the ultimate guide to help you get up to speed and start using the best development process around. And when I say ultimate, I’m not kidding – this 3,000 word article has just about everything you should need to get started!
In our guide for setting up a local WordPress development environment, you’ll learn:
- Different methods for developing WordPress sites
- Why local development is crucial for your workflow
- How to install WordPress locally
- Tips for an efficient development workflow
- How to deploy your WordPress site
- Tips for maintaining the site
1. Different methods for developing WordPress sites
The first step in the development workflow is (you guessed it) actually developing the site! And there are a couple different ways you can go about deploying the code. The first is to start developing right on a live server, which is sometimes referred to as cowboy coding. This is a very tempting method, as it feels the most convenient. Cowboy coding includes any form of code updates that directly affect a live site, including using the WordPress admin or editing the site’s files via SFTP. It’s quick, it’s convenient, and one little CSS tweak to the button styles won’t hurt anything, right?
When you develop on a live site, you risk breaking things that are, well, live. And if people are trying to visit the site while you’re in the middle of making changes, they might stumble onto some work-in-progress code that doesn’t look too great yet and ruins the reputation of the site owner. Plus, there’s really no great way to know what was changed each time you make an update. If you’re collaborating with someone, this can quickly cause some headaches.
The other, better option is to develop WordPress sites locally on your machine, instead of on a live server. This is much safer way to edit the files and write custom code, and definitely the method we’d recommend. And with a local WordPress development application (of which there are several!), this method is easier than ever!
So first, what exactly is a local WordPress environment?
The key to this phrase is local. With a local environment, you can spin up a WordPress site where all of the data is hosted directly on your own machine, instead of an external server via a hosting company.
And because all the necessary files are stored locally on your machine, it allows the browser to render the site and even allows you to access the WordPress admin to make changes. So while local sites aren’t technically live yet, they look and act live in your browser, allowing you to work just as you normally would on any other WordPress site.
2. Why local development is crucial for your workflow
You have no chance of breaking the live site
When you work on a local site, you’re not wasting any precious time or energy on a live server. This means that if you make a change that happens to break something, while you still have to fix it, at least your client’s live site isn’t busted (which could wreck their business and reputation).
While this holds true for brand new sites, it’s especially important if you’re making changes to an existing site. Think about it: how often do you make one single change that works flawlessly without needing a slight adjustment? Or when experimenting with new plugins, how often do you set them up without needing a few rounds of adjustments?
While it’s sure great when that happens, it’s just not realistic. And when you develop sites locally, you can tinker to your heart’s content without fear of actually breaking anything. It’s easily the best way to go about WordPress theme development or WordPress plugin development.
You can develop your site without paying for a live server
Hosting sites costs money, but developing a local site doesn’t (as long as you’re using a free app like Local by Flywheel). This means you skip that fee while the site is in development and only pay when your site goes live.
If you’re building a brand new site (either for yourself or a client) this can make a big difference. It’s hard to justify the cost of a live site if there’s only a “Coming Soon” page or an unfinished design to look at. But with a local site, you can skip that conversation altogether and get straight to developing.
You can work on your site offline
The final benefit to developing sites locally is that you can technically work on them disconnected from the internet. Because all the files you need are stored directly on your machine, you can access them whenever you need to. On a road trip? No problem. Feel like doing a little development on the beach? You go for it! With a local development environment, crummy WiFi will never slow down your workflow.
3. How to install WordPress locally
To get started with the magical process of local development, you’ll want an app to help you get started. Some options include:
- Local by Flywheel: This free tool makes local WordPress development a breeze! It’s built specifically for WordPress, available for Mac and Windows, and incredibly simple to set up. Formerly called Pressmatic, it joined Flywheel in 2016.
- MAMP: This Mac tool has been around for a while to set up personal servers, but it takes a little bit of set up to get a WordPress site up and running. It doesn’t install WordPress automatically, so you have to run through that process yourself.
- XAMPP: This open-source software can help you set up a PHP development server. While PHP is part of what runs WordPress, it’s not a WordPress-specific solution, however. It’s also fairly complex, so if you’re new to setting up local environments, it may not be the best choice.
- DesktopServer: This tool from the ServerPress team is WordPress-specific, but it does have a three-site limit if you’re just using the free version.
- Docker: This final option is kind of the DIY approach. You can create your own local WordPress environment using Docker containers, but we don’t recommend this unless you’re a pretty advanced developer that wants to tackle that setup.
They all have their pros and cons, but we’re going to focus on Local by Flywheel. We’re dedicated to building the gold-standard when it comes to web development, and we’ve had an incredible response to it so far. (Plus, there are lots of exciting things in store for it!)
A few features of Local by Flywheel
SSH + WP-CLI Access
Local by Flywheel offers simple root SSH access to individual sites, so you can tinker around if your heart desires!
Simple demo URLs
Show off your latest work with Live Links (shareable URLs)! They allow you to show your local WordPress sites to clients, collaborators, friends, or adoring fans before you even take it live.
Local SSL support
Any site created via Local by Flywheel will automatically have a self-signed certificate created. Green padlock achieved!
How to develop sites in Local by Flywheel
As for building local WordPress sites on Local, it’s very easy to get started, even if you’re brand new to development. Some other tools will make you install WordPress locally yourself or require a bunch of tinkering just to create a WordPress website, but Local skips all that hassle. With just a few clicks, you’ll have a local site up and running!
First, download the application. Once you have the ZIP file, open it to install Local by Flywheel on your machine. The first time you open Local, it’ll have to do just a hair of set up to create the local servers on your computer. Don’t worry, this doesn’t take too long!
Once everything is set up, 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.
Note: For each stage of site creation, you can choose to view the Advanced settings (great if you’re a seasoned developer!) or just breeze through with the basics (great if you’re new at this).
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 connecting the local site to Flywheel super smooth. If you’re looking for some other options, go ahead and select the Custom option. This will allow you to custom build your site with whatever environment you need!
Last, all you have to do is take care of a couple WordPress-specific options, such as your username and password. One you’re happy with your settings and you finish set up, your machine will begin setting up a local site right on your machine. This just takes a moment, as it has to configure the server and database. Then, you’re set!
Once you have your local site set up, the next step in the workflow is to actually start coding and developing your site. We won’t go into too much detail here (as it really depends on what type of site you’re building), but here are a couple ways to go about it.
Install existing WordPress themes and plugins
Let’s start with WordPress themes and plugins. Like we mentioned earlier, local sites behave like live sites, meaning you can still access the WordPress admin and install different themes and plugins. This works fantastically for testing things – you can try different plugins against each other, see what an update does, and so much more without worrying about breaking things.
WordPress theme and plugin development
If you’re interested in custom theme or plugin development, things are just as easy. All the files and stylesheets that make up your site live right on your computer, meaning you can access them and make changes as you please! There’s a link right in Local by Flywheel, making your files super easy to find.
4. Tips for an efficient local workflow
While no two sites are really the same, there are definitely some ways you can ensure a smooth development process, no matter what you’re building. Here are a few things we recommend to help keep your workflow efficient:
Know your favorite tools
Create Blueprints for quicker development
If you’re working with lots of WordPress sites and tend to reuse certain settings, themes, and/or plugins, Local by Flywheel features a great tool called Blueprints that will drastically speed up your workflow. It allows you to package up those repeatable elements as a saved template, allowing you to skip all the installation and start with those settings already set up.
For example, let’s say you’re a big fan of the Genesis framework and start there for all your sites. Instead of installing it on every single new site you create, simply save it as a Blueprint and you’ll be up and running in no time!
If you’re creating custom code, use git for version control
Git is a version control system that tracks changes to files. It’s a necessity for working on a team that needs to collaborate on the same code and great for tracking the changes that are made. GitHub is the most common host (which stores git repositories), but some other options include GitLab and Bitbucket.
Note: If you’re not creating your own code and just tinkering with themes and plugins, this step isn’t quite as necessary.
Use Live Links to get early feedback
Local by Flywheel has a nifty feature called Live Links that allows you to send a link to your clients so they can review your work before the site goes live. This saves you the headache of hosting before you need to, messing with mockups just to send screenshots, or trying to coordinate a meeting with your clients in person.
The earlier you can get feedback on your work, the faster you’ll be able to keep moving through the project and know you’re on the right track!
Join the Local Community
Have a question? Wanna request a feature? Looking for more workflow tips? Check out the Local Community, a place for Local by Flywheel users to connect and continue improving processes!
Once you’re all done with local development and have gotten client approval, it’s time to take your site live!
5. How to deploy your WordPress site
Traditionally, taking a site live could be kind of a hassle. You’d have to backup the files, export them, upload them to a host, hope it all got transferred okay, and then repeat for any further changes. Or if you’re a fan of SFTP, you could log into the server and transfer files that way, which is also a clunky process and runs the risk of moving things to the wrong location.
Those methods still work just fine, they just take a little time. If you want to host your site on Flywheel, we’ve made the process incredibly quick with our Connect to Flywheel feature. When you connect your Local sites to Flywheel’s managed WordPress hosting platform, there’s no need to mess with downloading and uploading and plugins and database exporting. Simply pair up these platforms to push local sites live with a few quick clicks, easily pull down live sites for offline editing, and sync up your tools for a simplified process.
6. Tips for maintaining sites once they’re live
Once a site is live, it’s up to you how involved you’ll continue to be. If it’s a personal site, you’ll probably check in pretty regularly. If it’s for a client, you could offer a maintenance package (for a monthly fee!) that includes some ongoing updates to keep it in tip-top shape. Either way, here are some of our top tips for maintaining a fast and secure WordPress site once it’s live!
Always update the WordPress core
One of the easiest ways to keep a site secure is to stay up to date on the WordPress version. If your live site is hosted on Flywheel, we’ll actually take care of this for you — you never even have to think about it. If it’s elsewhere, make sure you know if you host helps you out or if that’s something you need to stay on top of.
Keep themes and plugins updated
Along with WordPress itself, you should always update themes and plugins to protect against vulnerabilities. If you’re nervous about how the update will affect your site, just experiment with them in your local environment first. For example, you can pull your Flywheel site down to Local, run the updates, and if you’re satisfied with the outcome, simply push the changes to your live site. It’s an easy way to experiment and move back and forth!
Keep backups of your site
One of the best practices you can get into is to take regular backups of your site, just in case anything were to get a little messed up. If you site is hosted on Flywheel, we’ll take care of that for you, too. We run a nightly backup of your site and save it for 30 days, allowing you to easily roll back with just the click of a button!
As you push and pull copies of your site between Local and Flywheel, we also take backups during that process so you’re always able to roll back your site.
Never make changes on the live site
We know, we know…we’ve already covered this. But it holds true even once your site is launched! No matter how small the change is, you should always make it in a test environment first before editing the live site. And with Local Connect to Flywheel, you can easily push and pull those changes as you make them.
Install an SSL certificate
While your local site may have SSL (like Local by Flywheel offers!) you’ll need to install a real certificate once the site is live. Flywheel offers Simple SSL on every site, which includes a free certificate from Let’s Encrypt. Or if you need to bring your own specialty certificate, you can do that, too!
While every developer’s process may look just a little different, Local and Flywheel sure do make for one efficient development dream team. Pair up these platforms today for a delightfully simple development workflow.
I needed to be reminded of many things I’ve read before about WordPress and also find lots of new information on here that you put together. This is so important to me right now since I’m looking to switching into wordpress. Thanks Britt!!!
Docker is also another way to build websites and apps locally.
Did you ever sort the issue where the URL link Local generates to show, say clients your work expires every time you turn off your machine?
This the reason we don’t use Local. If you send a client a link and they don’t get round to opening it right away, say leaving it until the following day and you turn your machine off, the link is no longer valid.
Hey Pete, that’s definitely on our radar. The team is working hard to improve that functionality in 2018!
If I use LocalFlyWheel but later I want to host my wp website with a different host not with FlyWheel, how would I accomplish that?
Hey there, totally possible! While we’d love to help you out on Flywheel, all you have to do is export the site’s files, and then you can host it wherever you like :)
Hey Morgan, did your team ever get the Live Links issue worked out that Pete asked? Thanks!
This excellent website truly has all of the info I wanted concerning this subject “local WordPress development “and didn’t know who to ask.
Having read this I believed it was extremely informative. I appreciate you
finding the time and energy to put this content together. I once again find
myself personally spending a significant amount of time both reading and
leaving comments. But so what, it was still worth it!