How to configure VSCode to use Wordpress Coding Standard with no effort on MacOS.

Christian Giupponi
5 min readMar 27, 2021
Photo by Christopher Gower on Unsplash

If you work in a team you surely know how critical it is to have a coding standard to follow to ensure that every commit include only the relevant code and no change on space, brackets and so on.

Even if you work alone, having a standard is something that will help you later to keep a good code and maintainability over the time.

Almost every programming languages have its standard, Laravel, CodeIgniter and even Wordpress comes with standard that help the community to ship code that follow some fundamental rules. If you try to read the code of some big plugins you will find out how they looks the same in some aspect.

This article will help you to configure you VSCode to use the Wordpress standard. You will see how easy will be to follow it and how this will teach you some hidden trick to ship good code in terms of readability and security.

First of all here what you need on your machine in order to follow the tutorial, I’m pretty sure that almost all is already installed but if it is not just follow me, otherwise jump to the configuration section.

Here what we need:

  • composer
  • VSCode

Not so much, right?

Installing composer

First of all we need to have composer installed on our machine, it’s mandatory in order to download some dependency and it will make you developer life much more easy.

Composer is easy to install, you can follow the instruction on the site or type the following commands in a terminal:

php -r “copy(‘https://getcomposer.org/installer', ‘composer-setup.php’);”
php composer-setup.php
php -r “unlink(‘composer-setup.php’);”

This will download a composer.phar file that is the executable file.

Make sure to place the file in a safe place, you will need it quite often.

Now, to check if it works just reboot your terminal and then type:

php composer.phar — version

if everything works you should see the version installed, in my case I see:

--

--