How do I do local WordPress Development?

by May 3, 2019IT, Wordpress

So…just how can you do local development on WordPress? If you Google search this subject, you will find dozens of suggestions. Are you using Windows? There are like 20 choices…. Are you on a Mac, you have even more choices! Are you running Linux as your desktop? (Congratulations! I just haven’t managed to make that switch yet myself!) Do you even need a development environment?!? Wait…if you are asking that last question, then you DEFINITELY need one! You do *not* want to be the one that breaks production and gets management or customers breathing down your neck while you are desperately struggling to recover from whatever blunder/mistake/mishap you just caused!

So how should you do it? When I first started, I didn’t think I really needed a local development solution for WordpPress. I decided to take advantage of the backup scripts I setup (checkout this article and just develop on my DEV host. I had a great playground, was able to edit the PHP code with VI and everything worked. Except when it didn’t. I learned how to debug WordPress PHP code with an abundance of debug log messages…and tailing of Apache server logs and debug log output. It worked pretty well for a while. But then I wanted to be able to do more complex development. Not just a couple of filters here/a few functions there, but writing whole classes (yes, PHP can do OO, and even with WordPress you can, and should!) For this, I wanted a full IDE, and direct access to the files I was trying to edit.

I am a Java developer by day, and my go to IDE has been Intellij for a few years now. Enough so that I pay for it for my personal use (I like playing with code in my spare time, I find it soothing). At any rate, it has the ability to install the PHP plugins and makes a great IDE. Of course, the problem is that my DEV host is a virtual machine. Running on a server that is not my desktop. Without direct access to the files! I guess I theoretically could have worked on making the file system where my sites are installed accessible via some file share, so I could mount up the location on my desktop and edit away. But I wanted to find a more local solution, something that would work on my desktop without struggles or maintenance.

So, back to Google and my searches. There were still lots of choices. I tried good half dozen before finally settling on Local by Flywheel First, it is Free (there are options for teams of developers/agencies/enterprises, but if it is just you, you can do free!). Second, it just ‘worked’ when I tried it. All my other attempts ran into various issues that I just didn’t want to spend time trying to fix or workaround. Not that I didn’t try fixing them…but it quickly became obvious that I was getting into some quicksand that would suck away all the time I wanted to spend actually developing.

So, I installed Local, ran through some of the quick tutorials and quickly got down to work. Going back to my backup scripts, I was able to quickly leverage the existing backup I had to bring up a fully local development copy of any one of my sites. The tools provided by Local, and the direct file access it gives, made it super easy. It even pre-installs the WP-CLI for you, making the rewrite of URLS easy.

Now, I can work in my IDE, accessing local files, and have a browser window open that can instantly review my changes. Not only that, I can make my plugin (or theme) a GIT project more easily. I can use source control and save off my work (without leaving my IDE), and recover from my own mistakes.

Is this right for you? Honestly, I can’t answer that question, only you can. However, I can say it is right for me. Code forth and conquer!