Local WordPress Development

Many of our customers sign up for a hosting account and start building their website on our "live" web servers, usually using a temporary domain such as 'staging.mywebsite.nz'. This is totally fine of course, but there is a better way: developing locally on your own machine. Setting up a local WordPress development environment isn't very difficult and has a number of benefits:

  1. You don't need to pay for a hosting account -- you use your own local machine as a web server.
  2. It's faster! Editing pages and working in the WP Admin is usually much faster when hosting locally.
  3. No need to mess around with FTP. If you're editing theme files, you don't need to upload them to a remote server -- just hit save and it's done!
  4. You can work offline, because you don't need an internet connection.

Options ... So Many Options

As with just about everything these days, there are many options available for local WordPress development, and choosing the right one for you can be tricky. What you ultimately decide to go with will depend on factors such as:

  • Your technical skill level
  • How many local sites you need to host
  • Whether you need to be able to set up sites with different environments i.e. different PHP versions
  • How powerful your local computer is (RAM and CPU capacity)

We have a page in the Resources section of our website, listing many of our favourite WordPress development resources, including local development tools.

There are many tutorials available online to help you choose the right option for you and walk you through setting it up, so rather than going into too much detail here, we're going to summarise a few of our favourites and then refer you to some comprehensive tutorials available elsewhere. So, here we go...


Desktop Server

DesktopServer lets you quickly and easily set up multiple WordPress sites on your computer. An important thing to note about DesktopServer is that there is a Free and Premium (paid) version. The free version has some limitations. Check out the website for a feature list of Free vs. Premium. The other notable thing about DesktopServer is that is one of the easiest local development environments to set up and use.

After signing up for an account and downloading the software, a set-up wizard takes you through the installation process. Once DesktopServer is installed on your computer, you can set up your first WordPress site.

Whenever you need to set up a new WordPress install, just launch DesktopServer and choose the option to create a new development website. It will configure the site and then provide a localhost URL where you can start working on your site.

Key features:

  • The wizard makes it simple to set up a new WordPress install in about 1 minute.
  • Cross-platform support for MacOS and Windows.
  • Save blueprints, aka website configurations, you frequently use so you can quickly set up new WordPress sites.
  • Supports WordPress Multisite (WPMU).

Local by Flywheel

Local by Flywheel is a localhost solution that has quickly gained in popularity thanks to its user-friendly interface.  It is also completely free!

While tools like XAMPP and Vagrant are powerful, giving you more control over your local server environment, they’re not exactly easy to use if you don’t have a development background. Local by Flywheel, meanwhile, is perfect for beginners and developers alike working on small to medium website projects.

Local by Flywheel is free to download, but you’ll need to sign up for an account. Local by Flywheel is available for MacOS and Windows.

Setting up a new WordPress website is as easy as clicking through a wizard. During setup, you can choose the default setup (PHP 7.2.9, NGINX + Varnish, and MySQL 5.7 at time of writing), or set up a custom install with your choice of PHP version, web server (NGINX or Apache), and version of MySQL.

Key features:

  • Create a new WordPress install in just a few clicks.
  • Cross-platform support for MacOS and Windows.
  • Set up “blueprints” so you can quickly deploy new sites using frequently used configurations.
  • Set up custom configurations using your choice of PHP and MySQL versions, and Apache or NGINX — and you can hot-swap once you’re up and running.
  • Access to SSH and WP-CLI.
  • Supports WordPress Multisite (WPMU).

Vagrant

So far we’ve looked at options that are great for WordPress "builders" (as opposed to "developers") and those working on small to medium websites. But what about large sites, or more experienced developers who need greater flexibility and portability?

Vagrant lets you create and configure lightweight, reproducible, and portable development environments — virtual machines — which you can use as local server environments. It’s ideal for developers who want full control over their localhost environment since you can control every aspect of it, even more so than solutions like XAMPP.

Setting up Vagrant is a bit more involved than the previous two options, but once it's done and you have your workflow configured, it is very powerful and flexible.

We use Vagrant here at WP NET and have our own provisioning script so that we can just drop a ZIP file and a SQL file of a WordPress site into a folder, call vagrant up and a few minutes later we have a completely isolated virtual hosting environment with the site imported and ready to go. It also sets up all our favourite development tools like WP-CLI. Very cool.

After downloading and installing VirtualBox and Vagrant, you can then download one of the many pre-configured “boxes” shared by the Vagrant community. We recommended VCCW, a Vagrant configuration for WordPress plugin, theme, and website development.

Key features:

  • Set up virtual machines for local development.
  • Flexible and portable — configure virtual machines and share them with your team.
  • Download pre-configured boxes created by the Vagrant community.
  • Use the command line to manage your virtual machines.
  • Cross-platform support MacOS, Windows, Linux and more.

Vagrant Links and Resources:


Further Reading

Some Things to Note When Developing Locally

A local hosting environment can only be accessed from within your local network, so if you want to someone outside your network to view the site, you will need to transfer it to a remote server that is available on the internet. There are ways to get around this, but doing so can be quite complicated and is outside the scope of this article.

If this is something you want to look at, what you essentially need is a development domain that you can use -- such as 'dev.acmewebdevelopment.nz', a dynamic DNS service (unless you have a static IP address). You also need to set your machine to use a static IP on your local network, and then configure your router for port-forwarding.

Was this answer helpful? 0 Users Found This Useful (0 Votes)