As you get older three things happen. The first is your memory goes, and I can’t remember the other two. – Sir Norman Wisdom

One of the keys to being a productive WordPress developer is to automate your WordPress development workflow. That is, wherever possible let tools and scripts do your work for you. The less work that you have to do and the fewer processes that you need to remember to follow, the better a WordPress developer you will be.

In a perfect world, we’d all be infallible and code would run bug free on the first execution. As we know, this world is far from perfect and as humans we are definitely prone to making mistakes as we code.

Automating your WordPress development workflow can bring your closer to being like that infallible developer we’d all love to be.

What to automate in your WordPress development workflow

There are a few crucial things that you need to automate right away if you have not already done so. They are:

  • Development environment. If you’re having to manually create a development environment every time you start a new project, reformat your machine or have someone else work with you on a project, then you really need get setup with a scripted development environment.
  • Code standard and listing checks. You should be automating the checking of your code against the WordPress Coding Standards. I’ve discussed why this is important before. Standards and linting checks should preferably be done as you write your code, but as a last resort, before each code commit.
  • Code completion. You will save yourself a ton of time by using a code completion tool that understands the WordPress codebase as well as the code you’ve written and can autocomplete based on that knowledge.
  • Snippets. Have a decent library of repeatable snippets of common WordPress code that you use often. These snippets should also include those pesky function calls which you forget the implementation details of and usually end up having to reference the WordPress documentation to figure out.
  • Boilerplates. Similar to snippets but on a larger scale, boilerplates save you from having to write structural code for your projects and let you skip straight to the important pieces such as the functionality. At the very least you should have a theme and plugin boilerplate that you reference when starting a new project.

There are some additional areas where you can look to setup automation. They include:

  • Deployment. Are you still FTP’ing files up to your server? You can automate the deployment of your code from your local development environment to live with a single command.
  • Unit test execution. Unit tests are a vital component to a maintainable project. I love writing tests. If you’ve got tests, automate the running of those tests either in your IDE or on commit.
  • Scripts for doing repetitive tasks. If you find yourself repetitively typing the same few commands in to a terminal to get something done, then you should write a shell/bash script to run those commands using a single command. A good example would be your Git workflow.

How to automate your WordPress development workflow

Luckily, WordPress has a thriving development ecosystem and there are great tools for automating your WordPress development. Here are some of my favourites:

  • VVV – A scripted WordPress development environment. Enough said 🙂 Also be sure to check out VV for creating sites on top of VVV. I’ve also written an article on setting up VVV with videos.
  • WP-Dev-Lib – This is a set of scripts that can be implemented on top of any WordPress project. They help automate the linting, running of tests and deployment of WordPress themes and plugins. See my article on applying WordPress coding standards for a video on setting up WP-Dev-Lib.
  • PHPStorm – I know that IDEs are not everyone’s cup of team and if you’re one of those developers who doesn’t like an IDE, I would urge you just to try out PHPStorm for a week and see what it can do for you. In terms of automation there are snippets (Live Templates), Emmet, the best WordPress autocomplete you will find anywhere and many more features that make your WordPress development bliss.
  • TextExpander – I use TextExapander to save code snippets that can be used inside PHPStorm or anywhere else really.
  • WP-Foo-Bar – I’m biased here since this is built by XWP and I work there of course, but choose any standards based WordPress plugin boilerplate and use it religiously.

That should be enough to get you setup with a well automated WordPress development workflow.

The sheer amount of tools and scripts available for automation may seem overwhelming. I would suggest that you start small but implementing a single item. Once you’ve got that down, move on to the next tool or script.

Before long you will have eliminated a lot of the grunt work out of your workflow and you will be writing cleaner and more reliable code.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.