How to use Local by Flywheel for Quick WordPress Development
Developing websites locally can be an attractive proposition for several reasons. For starters, it’s free. If your Internet connection is non-existent or lost you can keep working. You can use localhost as a testing ground for trying out themes or plugins or creating your own. Finally, your sites remain private until you choose to share them.
Traditionally, setting up websites on localhost was a tricky process, but that’s all changing with new solutions like Local by Flywheel.
What is Local by Flywheel?
Local by Flywheel – aka Local – is a local development environment, optimised for WordPress. It’s an alternative to similar tools such as XAMPP, MAMP and WAMP.
Local by Flywheel does the heavy lifting for you behind the scenes so that you can get on with developing sites quickly. A new WordPress site can be installed in a few clicks – no more downloading WordPress, no editing wp-config.php or fiddling with ports! Local handles all that for you.
Chris Coyier of CSS Tricks is a fan, as are developers and teachers Carrie Dils and Tonya Mork.
Installing Local by Flywheel
Local by Flywheel is available for both Windows and Mac, and free for download. The current version is 2.2.4.
Just supply a few details to download it.
Go through the initial setup. It should only take a few minutes.
When Local is done installing, it’s time to create your first site!
Creating a new site
Creating a site is a 3-step process:
- Setup site
- Setup environment
- Setup WordPress
The first step is to name your site. Whatever you choose will be copied across to your domain and path (see the Advanced Options).
By default your site domain will end in .local, but you can change this to another suffix if you prefer e.g.
You can in fact change both the name and the local URL later, but not the site path. So if you want to choose a custom path, do it now.
Next, you have a choice of server environments. If you host with Flywheel, you’ll want to use their Preferred option, which mirrors their own web hosting.
Otherwise, you can select your own Custom setup, with the choices of:
- PHP version: 5.2.4 to 7.2.0. (If you intend to move your site to production there’s really no reason to run a lower version of PHP – here’s why you should run PHP 7.0 or greater.)
- Web server: nginx or Apache
- MySQL version: 5.5 or 5.6
If you want a multisite, be sure to click on the Advanced Options to get the choice, as this can’t be changed later. Local supports both subdomain and subdirectory multisites.
You can save your preferred username/password across all your sites if you want.
Once you hit Add Site, wait a minute or two, then you’re done. Hurrah!
So what can you do next? Let’s look at some of Local by Flywheel’s features.
Site Setup view
Your first view is of the Site Setup. From here you can:
- View a site.
- Log in to your site.
- Stop the site – or start it if it is stopped.
- Open the folder on your local machine with the site’s files – click on the arrow next to the path under your site’s name.
- And more…
SSL support is there but you need to enable it: go to the SSL tab and Trust the certificate.
You can then go to e.g.
https://my-first-site.local and see a green padlock.
If you typically build sites with the same basic setup, save time by saving your site as a Blueprint.
Create your site and add your commonly used theme(s) and plugins (say, all your favourite WPMU DEV plugins or try out some of our free plugins). Then in Local by Flywheel, right-click the site you want under Local Sites and choose Save as Blueprint.
You can then easily re-use this configuration when you add a new site.
You could even have Blueprints for different types of sites, e.g.
- a small business site
- a portfolio site
- an ecommerce site
Your Blueprint will be a snapshot in time. So if your plugins or themes need updates by the next time you want to use the same combo, update them and resave the site as a new Blueprint.
Cloning a site
Any Local site can be cloned to create a new Local site. The process is very similar to making a Blueprint, except that the configuration isn’t stored for reuse.
Exporting a site
Exporting creates a zip file of your entire site configuration. You’d use this if you want to move a site into a Local installation on another computer.
Switch your server environment
Imagine you are developing a plugin and want to check that it runs with different versions of PHP. No problem! It’s super simple to change PHP version with Local.
From Site Setup, select a Custom setup for your Local Environment. Then you can simply upgrade or downgrade PHP on the site you are working on. Or indeed, change web server.
This works because each site lives in its own container powered by Docker.
When you do this, there are a couple of warnings:
- If you used SSH access (see later) you’ll lose any changes you made, unless you Clone the site.
- You may have to wait for new dependencies to be downloaded.
Copying a live site to Local by Flywheel
If you don’t have hosting with staging as a feature, working on a local copy of a live site is a very good way to test out changes without risking mishaps.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
If you’re lucky enough to be using Flywheel’s hosting service, copying a site is easy. You can log in and connect it to Flywheel, then pull live sites. into Local.
Note that copying multisite installs is not supported at this time.
Otherwise, copying your live site is relatively simple. All you need is:
- A backup of your site’s wp-content folder.
- A .sql file with the site’s database.
Move the SQL file inside the wp-content folder, then zip the folder.
Then drag and drop this zip file into the Local by Flywheel window. The app does all the hard work for you in recreating the site, including rewriting all the URLs. Sweet!
Local development considerations
You won’t want Google Analytics running and logging visits on your local install. Depending on how you’ve entered your tracking code, you can:
- Remove it from functions.php
- Remove it from Theme Options or via the Customizer
- Deactivate a Google Analytics plugin you might be using
The same goes for the Facebook pixel and any other tracking codes you might be using.
Jetpack hasn’t played well for me when I’ve duplicated a site using it locally. I find it wants to disconnect my live site from WordPress.com. For this reason I tend to disable it on Local by renaming the
jetpack plugin folder to
You can also deactivate any security plugins like Defender when you’re working on a Local by Flywheel site. Remember to reactivate them later if you’re making the site live.
Creating a live link for your site
When you’ve worked for some time on a local site, but it’s not ready for production, you might want to share it with a colleague or see how it renders on a phone. How can you do that?
Instead of moving it to a testing server, Local by Flywheel has a nifty “Live link” option courtesy of ngrok. Enabling this will give you a live URL to use from any device.
Like Mission: Impossible, your link will self-destruct after a certain period of time – namely, the time when you shut down Local by Flywheel. That’s fine for getting quick feedback, but not so great if your colleague or client gets back to you in a week! Every time you re-enable the live link, you’ll get a different URL.
Moving a site from Local by Flywheel to a live server
Flywheel users can use their Connect option to push single install WordPress sites to Flywheel’s hosting.
Not hosting with Flywheel? One option is to use the Duplicator plugin to move the site to a live server. I used Rae’s tutorial on migrating WordPress from localhost to live and it worked perfectly.
Make sure that Duplicator cleans up the files it creates when it’s done. The
local.phpinfo.php file created by Local by Flywheel can be safely deleted through FTP or your hosting File Manager.
I’m used to viewing the database for a WordPress site on phpMyAdmin. Local by Flywheel uses Adminer by default, which is not such a nice user interface, but it gets the job done.
Alternatively, if you’re a Mac user you can download and use Sequel Pro.
One disadvantage of developing locally is that transactional emails aren’t sent by WordPress.
Fortunately, under the Utilities tab you’ll find the MailHog tool, which logs any emails sent locally. If you’re testing out any plugin which sends email – such as Forminator Pro, Events+ or WooCommerce – you can make sure their emails are working correctly.
Note that if you restart Local by Flywheel, any emails from your previous session are not stored – so you are better off checking MailHog as you go along.
SSH Access and WP-CLI
Right-click on any running site and you can open it via SSH. WP-CLI is already installed; type
wp to see the list of commands, and
q to return to the command line.
Use WP-CLI to handle tasks quickly. For example, activate all plugins on a site, or delete all transients.
To learn more about WP-CLI, read:
- 10 Ways WP-CLI Can Speed Up WordPress Development
- Advanced WordPress Development: WordPress Automation With WP-CLI
Git is not installed on Local by Flywheel, but you can add it easily enough. Follow the Deployment with git section in this article: Using ‘Local by FlyWheel’ as a Local Development Workflow for WordPress.
Your preferences for creating sites are stored in the Preferences area. On Windows, access it via the hamburger menu in the top right corner. On Mac, go to Local by Flywheel > Preferences in the menu.
You can also see all your Blueprints and try running some experimental features.
And if you use XDebug and PHP Storm, there’s an add-on to integrate them with Local here too.
Local by Flywheel is supported by a community forum.
If you have any problems with its setup or running, as I did when installing Local on Windows for the first time, the FAQ is a good starting spot.
If you want Local’s developers to add something cool, add it to the Feature requests subforum.
I really like Local by Flywheel. It’s quick to set up, simple to use and has enough extras to make it worthwhile. My favourites are Blueprints and live links.
It’s now my go-to tool for local development.