Local Development in WordPress
For many developers, the convenience of coding while working remotely can end up being a challenge.
While one of the perks of being a developer is, alongside a laptop and an Internet connection, the ability to work from anywhere, there are many cases where an Internet connection is far from a sure thing.
Maybe you’re commuting via bus or plane or maybe you’re exploring a new country where the Internet connection is spotty. Relying on a shaky or unsure Internet connection is simply not an option for many developers, especially when they’re working on mission-critical projects for their clients or an employer.
As it turns out, an Internet connection doesn’t have to be a necessity for development. Developing in a local environment allows developers to spin up a WordPress site where data is hosted directly on their own machine without having to connect to a hosting provider’s remote servers.
If working remotely is your thing or you’re simply looking for a way to develop and experiment with more efficiency, local development could be a great option for you. In this article, we’ll discuss the benefits of using local development in WordPress, when local dev is appropriate, and the technology that will help you get there:
Benefits of Local Development
- Work offline – As mentioned above, with your WordPress site on your local device, you can work on it without being connected to the Internet. No WiFi, no problem.
- Speed – Developing with a local environment is faster because there’s no waiting for a network connection. Ultimately, this means faster development cycles and maximum productivity.
- Privacy by default – Developing locally prevents visitors from seeing changes you make to your site in real-time. The local environment acts as a barrier so that you can make sure new changes are compatible before deploying.
- Experiment safely – Plenty of things can go wrong when incorporating new themes, plugins, or code into your site. One wrong line of code can wipe your site out. Local environments allow you to test changes on a variety of browsers and screen sizes without the risk of breaking anything on your live site.
Local Environments vs. Staging
Although local environments are ideal for most situations, sometimes a staging environment is the better choice. While a local environment stores all of your WordPress files on your PC or Mac instead of a web server, staging environments are typically installed on a subdomain of a parent site making them accessible on the Internet but still hidden from the public.
As previously discussed, there are many advantages to using local environments. The lack of need for an internet connection makes offline work possible; developers also don’t have to worry about downtime or performance issues resulting from a poor connection. However, in order to access your site in local dev, you have to be in front of the device in which your WordPress sites are stored. You will not be able to access the site from a different device, if necessary.
In a staging environment, your WordPress files are stored on a live web server. The advantage of this is accessibility. Your WordPress site can be accessed anytime, from any device. This is convenient if you want to elicit feedback from a client located elsewhere. Additionally, staging environments are already on your host’s server, so you might be able to identify incompatibilities that wouldn’t be evident in a local environment. One last thing to consider is the increased accessibility of staging sites also increases security risks and concerns.
The right environment for development is largely circumstantial. If you want to ensure the highest level of security, a local dev environment would be best. However, if part of your workflow includes sharing sites with clients or coworkers not local to you, a staging site might be the best option.
Docker for Local WordPress Development
Docker offers container-based development and services that enable you to deploy Docker for local WordPress development. Using Docker, you can set up self-contained environments using a few simple commands. This becomes especially useful if you need to set up several local environments that require different servers or tools because container technology gives developers a way to virtualize an OS so that multiple workloads can run on a single OS instance.
While you can set up local environments in multiple ways, Docker offers developers the ability the spin up containers with isolated development environments using fewer resources than a virtual machine. Docker makes it easy to solve multiple problems across a diverse set of requirements and use WP-CLI to manage WordPress installations from the console.
Getting Started with Local Development
If you’re looking to implement faster development cycles, have the option to work offline, or enjoy an environment that is safer for experimentation, a local development environment might be just what you need.
For more information on WordPress, WP Engine, and local development, check out our webinar: Build Better Sites Faster: WordPress and Local Development. Stay tuned to the WP Engine blog for upcoming information on using local development on our digital experience platform.
Hi there, recently I read an article that you can connect the Local (flywheel’s app) with WPEngine. Is this true, and do you know where we can find more details about that?
Thanks in advance!
StefanoWP
Hey Stefano. I work for WP Engine and can provide guidance here. The work to allow WPE customers to push/pull with Local is currently under development. I’m not exactly sure of the release date, but I’m fairly certain it will be available in the early part of 2020. I’m pumped for this addition and am on the edge of my seat for it to be released as well 🙂
I hope this helps!