The Ultimate WordPress Development Environment

By Matt Geri
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

WordPress development has come a very long way in recent years when it comes to tooling. In the past, developing a WordPress website required some sort of MAMP/WAMP localhost setup and almost always, a rather painful headache. Maybe you’re even one of those developers who developed their website on a live environment – I was.

Luckily, times have changed and there are now tools that help take the headache and repetitiveness out of building WordPress sites on your computer.

WordPress Development

In December last year, after 3 years of being almost completely devoid of any WordPress development, I became a full time WordPress developer again. Before that 3 year stint in the payments industry, I was a full time WordPress contractor.

Being out of an industry for 3 years, gave me a unique perspective on how fast things change in computing and more specifically, web development. WordPress development is no exception.

You see, when I returned to WordPress development in December last year, I decided to look at setting up the perfect WordPress development environment. I was pleasantly surprised to see that the tooling around WordPress had advanced so much that it was much like trading in a Ford for a Ferrari.

I was excited, and still am of course, to explore all the tools and in today’s article I’m going to share with you a summary of what I have learned. Hopefully it will help you tweak your current environment and implement some of the tools that are available to you.

It Starts with the Server

To begin with, the most important piece in the WordPress development environment puzzle is the server. Without a server, we can’t do anything.

There are so many different options available today to host WordPress websites on your local environment that it gets tricky to know which one to use.

I’m going to suggest that you drop MAMP/WAMP/XAMP and start using a virtualized development environment.

Why? There are so many reasons:

  1. It’s an isolated environment. By using a virtualized environment you’re creating a development server that is isolated from your host operating system. You can install whatever operating system you like on the virtual machine and start/stop/restart it without affecting your host. It’s easy to tear down once you’re done with development and no longer need it.
  2. Messed something up? No problem! Just rebuild the environment. I’m sure we’ve all been in the sticky situation where we’ve tinkered with our server settings and blew stuff up. This is easily fixed by rebuilding the virtual environment or simply using snapshots. So now you can play around and tweak your settings without fear of failure.
  3. As close to live as you can get. You can literally replicate your live environment on your localhost if you wanted. Having these two environments exactly the same helps with debugging, tweaking and even deployment.
  4. You can run multiple different server environments, on a single computer. Have one client using Apache and another Nginx? No problem, create those two different environments in virtual machines and you’re good to go.
  5. Unified environment across development teams. If everyone on a development team uses the exact same setup, it speeds up development time and there are less questions about why something is not working on x person’s machine.

Now that you’re sold on a virtualized environment. What should you use?

I’m using VVV. For me it was extremely straight-forward to get up and running, has a good support system around and it is used by many of the big WordPress development agencies, including the one I work for, XWP.

Some of the other options for a virtualized WordPress development environment include: HGV, Wocker, VIP Quickstart.

If you decide to go with VVV, then I definitely recommend the following plugins and tools to take VVV to the next level of awesome.

  • vagrant-hostsupdater – This plugin allows your vagrant installation to update the entries in your computer’s hosts file for adding domain mappings to an IP address. This means you don’t have to manually add entries to your hosts file.
  • Variable VVV – By far the most useful tool for VVV is called Variable VVV and what it does is gives you the ability to quickly and easily create new VVV WordPress installations using the command line. Definitely check this one out

Aleksander Koko has previously written about VVV, and I’ve also recently recorded a video on how to setup VVV on your own computer.

The Power of the Command Line

Who doesn’t like a bit of command line fu, right? WP-CLI is the answer to your inner command line desire.

WordPress WP-CLI

WP-CLI let’s you manage a WordPress installation from the command line (it ships with VVV by the way).

Let’s look at some practical examples of how you can use WP-CLI in your local development environment.

  • Install WordPress. SSH’d into your server and need to install WordPress quickly? Simply use WP-CLI to create a new WordPress installation.
  • Update WordPress. There’s not much more painful than updating tons of WordPress websites by visiting each one, logging in, clicking around and then updating. You can do this straight from the command line with a single command.
  • Installing plugins. If you’ve found a great plugin that you want to install across multiple sites, again, do it with one command using WP-CLI.
  • Resetting a WordPress database. Messed something up and want to start off fresh? Easy, one command (this is getting a little repetitive isn’t it?)
  • Import content. Yep you guessed it, you can import content into your WordPress install or multiple installs with one command.
  • And so much more

That’s all quite handy stuff that you can do from the command line. Best yet, in the next section we’ll talk about an IDE and you can run all these commands directly from that IDE.

If you’re interested in learning more, check out this article on WP-CLI by Ahsan Parwez.

An IDE That Makes a Difference

Out of all the tools I am talking about today, I have a feeling that this is going to be the most contentious. When it comes to IDEs and editors it’s almost as if you’re invading personal space, and a lot of people don’t like that.

I’m not going to try and tell you an IDE is better than a text editor or vice versa. What I’m going to do is tell you my experience of switching to an IDE and how it worked for me.

I have always been someone who has disliked IDEs. Dislike is probably being kind, I hated them. I felt they were bloated, slow and cluttered.

I was a big Sublime Text fan (and still am by the way, I use it daily).

So in December, as I was getting back into WordPress development, I checked out what editors were available to write WordPress code. I was quite surprised when an IDE by the name of PhpStorm kept getting a mention.

Reluctantly, I took a look and boy am I glad that I did!

PhpStorm is the best IDE for PHP and WordPress development, in my opinion. It offers everything you need to build WordPress websites, plugins and themes all in one place and it has incredible WordPress integration (you really need to check it out).

Here are three reasons why you should consider PhpStorm this year for WordPress development:

  1. Everything you need, in one place. FTP – check, database support – check, terminal – check, version control – check, debugging – check, refactoring – check, great intellisense and autocomplete – double check! And so much more.
  2. WordPress integration within PhpStorm is second to none. PhpStorm understands WordPress deeply. Once it’s hooked up to a WordPress project it knows how everything ties together. It autocompletes on WordPress functions and even on actions and filters.
  3. Many of the top WordPress developers and agencies are now developing their code with PhpStorm. That to me is a clear sign that it’s one of the best IDEs for WordPress development available.

If you’re interested in getting started with PhpStorm, then check out a series of 7 PhpStorm videos that I recorded to get your started with the IDE.

Making Sure Your Code Is Silky Clean

The last tool that I am going to write about today is a doozy! I’m particularly pedantic when it comes to writing code. I like it to be silky clean and follow the WordPress coding standards to a tee.

But even being that pedantic, we’re all humans. And very often I find myself going through the code that I have written and cringing about a missed space or extra new line.

Being in the Open Source world, it’s extremely important that developers stick to coding standards that are defined by the projects otherwise a codebase degrades extremely quickly, especially on a popular Open Source project like WordPress.

In fact, the WordPress core team is particularly strict about coding standards and that they’re followed.

So how can we make sure that our code follows the WordPress coding standards? The answer is simple and it is a tool called PHP CodeSniffer with the WordPress coding standards ruleset.

WordPress Coding Standards

These two utilities will scan your code, find any discrepancies between your code and how it is expected to be written by the WordPress project and inform you of what is wrong. Magic!

Best of all, they will also notify you of any high level security issues that it encounters. Now it won’t catch every single security issue so make sure you’re always thinking about security when you’re writing your code but it is a good first line of defense.

Of course, I wouldn’t be able to complete this section without mentioning that PhpStorm has baked in support for PHP CodeSniffer. I’ve released a video on how to tie PhpStorm, PHPCS and the WordPress coding standards ruleset together.

In Closing

There are many alternatives to the tools above and my hope is that at the very least everything I have spoken about today gets you interested in exploring some of the awesome tooling around WordPress development.

The above tools, should you chose to use them, will give you a great foundation for getting started with a more streamlined and automated approached to WordPress development.

If you have other tools that you use, I would love to hear about them in the comments below!

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • Eno

    Great article Matt. I’ve been thinking about using VVV but was unsure how to implement it, I still am but at least now I’ve got a good set of starting points. How does this work with some of the tools like phpStorm and WP-CLI if you are using a framework like Genesis.

    • Great Eno!

      Check out the VVV video on my site, it walks you though exactly how to set it up :)

      VVV integrates brilliantly in to PhpStorm (For Vagrant management and Debugging with XDebug). It also ships with WP-CLI, so when you SSH in to VVV, you can start using WP-CLI immediately :) I don’t have much experience with Genesis, but it shouldn’t make a difference.

  • Todd Zmijewski

    “I like it to be silky clean and follow the WordPress coding standards to a tee” – Within the context of WordPress that is like saying you live in a box on the street but but like to keep the place nice and tidy. People who use WordPress as gospel but preach standards and clean code are delusional.

    • Todd, nice analogy!

      At the end of the day, what are coding style standards there for? To write better code or neater code? I’d argue neater code. Standards define how you should write your code, they don’t define how you should architect your code. Maybe I’ve missed it, but nowhere in the coding standards section does it talk about well-structured code?

      So putting WordPresses architecture aside, neat code is relative. What you you think is neat code may be different from what I think is neat code. However the most important thing on a project is that everyone follows the same standards so (even if you don’t think it’s the right standard) the code is written in the same way (benefits of this described above). That’s all that is being said in the statement that you quoted.

      It feels like you’re saying because WordPress isn’t architected how you and many others (myself included) feel is best, there can’t be any code standards? That doesn’t seem right to me. Maybe I am misinterpreting what you’re saying?

      • +1 for Clean & Neat != Good.

        As you mentioned, WP is worthy of it own stated standards. Unfortunately, you wouldn’t give a n00b WP as an example of “this is how it’s done.”

        Powering 25% of the non-dark web is a pretty big responsibility. Ya have wonder how we got this far without a better sense of QA. And now the REST API is like putting new paint on a car with a flat tire. Perhaps the tire should have been the first priority?

  • Jack

    @MattGeri:disqus Whilst the code sniffer is probably nice, PHPStorm has the WordPress coding standards built in, simply set the projects code style to WordPress, then it’s as simple as Ctrl + Alt + L and it’ll apply the WordPress coding standards, or any other standards you’ve applied / created.

    • Hey Jack!

      You’re right, however the PHPCS and WordPress Coding Standards projects provide more than just syntax checking. It warns you of security issues, forms without nonce values, caching issues and quite a lot more. Also if you’re developing for VIP it will warn you about VIP problems too.

      As a first line of defence though, the built in WordPress code style checking is great. I have it enabled on all my projects :)

      • Julianna Cunningham

        Last year my income was 220k Dollars despite i was a student. I am connected with an entity that I heard about and I have received such great cash..wt It is really user friendly and I am just so happy that I found out about it. Why not try it .

  • Command line is a PITA! Nothing is ever easy and instructions never seem to work which send you off googling for answers.

    Trying to install the code sniffer. Just seems to be one problem after another. Now despite having seemingly installed everything correctly, it won’t validate in PHPStorm. “cannot run program error 13 permission”.

    Have spent a good 2 hours on this, but had enough.

    Seems to be you have to be an ubergeek-command-line-ninja to use half these tools. So those of us who aren’t, miss out. :(

    • Sorry to hear you had troubles getting everything setup Chris. Is there anything specific I could help you with to get it up and running? Error 13 does sounds strange to me, I’ve never seen that. Are you on Mac or Windows?

      • Thanks, Matt. I will get back to you – I just have to sit down for half and hour and write up what i did.

  • Oscar Blank

    None of your suggestions address one of WordPress’ biggest shortcomings, and that’s the way it basically hardcodes the domain in URLs scattered throughout the database. Of all issues related to WordPress development, I was hoping to see you address that one. Sure, you can set up your dev server to serve as the production domain, but that’s a pain if you want to go look at the production domain (switch back and forth). Many times, if you develop locally using a domain like “localhost”, you can’t just do a global search and replace on the DB when you move the site to production, because if “localhost” is in some serialized data (as many plugins utilize), you just corrupted the data. Do you have any suggestions or plugins that handle this issue?

    Now, lets be honest … WordPress’ code quality is utter spaghetti. It’s exactly the kind of code that you would show a beginner dev and tell them how not to code. It’s kind of funny that you emphasize “Silky Clean Code” in light of that. Then, to really put the nail in WordPress’ coffin, they seem to have never learned about database normalization. Everything under the son is just thrown into the posts table and the options table. How does your squeaky clean code matter? It’s like going to a hot dog stand and expecting to order a fillet mignon steak.

    • Hi Oscar,

      WP Migrate PRO solves the serialization issue. I never move local data to production. Only the opposite way if I need data in staging.

      As I mentioned in my reply to Todd, there is a big difference between clean code (in terms of coding style standards) and architecture. Coding standards don’t define how you architect your code. I think I maybe should have emphasised this more in the article as a few people have assumed silky clean code equates to good architecture.

      I think we can all agree that WordPress isn’t architected as well as it could be and it won’t change anytime soon because of legacy reasons. It is what it is, you can accept it and work with the platform that powers 25% of the web (and enjoy the business benefits that come with that) or you can work on something else. Your choice. Nobody is forcing you to make that decision, it’s up to you.

      Lastly, the wonderful thing about open source software is that you can contribute back and fix something you think is broken. Why not, as a first step, contribute a patch to fix the hardcoding of links? :)

  • Thanks Mike! I will definitely check it out :)

  • Thanks for the heads up Greg!

  • Thanks for sharing effective information with us

  • brian

    Hi, i am looking for solution to create a dev and staging env for my wordpress site.

    I have came across method with creating a subdomain for staging(which is fairly easy).

    It makes sense to me to use a VM for the dev, but i am concerned with a few things

    1. if the VM runs on my machine, how can other admin of my site to access this local copy?
    2. How do we do version control?
    3. How to deploy it to staging and live site?
    4. I dont have experience with php, is VVV still a good choice? (I am not looking to develop any plugin or themes)

  • Great article! I’ve been using phpStorm and like it as well, though they have some confusing terminology – for example, they say they support wordpress plugins but don’t seem to say they support wordpress themes (at least in the UI). Is this just me?

  • derpoho

    Hmm… For me this setup never was the best solution.

    We are currently pushing sites with Docker (compose), outsourced content directory and WP as submodule, which is by far the best solution out there.

    Updates: git fetch –tags && git checkout 4.7.2
    Start Env: docker-compose start
    Stop: docker-compose stop

    Done. No heavy Vagrant lifting, multiple sites, multiple environments, all included. ;)

    But that are just my 2 cents.


    • Shiro

      Any possibility you share a video tutorial or gist workflow? Looking forward for your sharing

      • derpoho

        I will… Will keep you updated.

        • keramzyt

          I’m very interested to hear about, too

  • Jan Pozivil

    I’m interested, Mike

  • WorldWebTechnology

    Matt, The exclusive post really sounds cool..! I totally agree with you about the server and clean codes. I am also a WordPress Developer and the provided WordPress Environment is pretty cool for every WordPress technical professional.

  • mefynn

    thanks for sharing. i recently switched from atom to phpstorm. great ide!!