Managing Advanced Custom Fields PRO with Composer

When I create new sites in WordPress I usually start of by installing Bedrock by Roots. This is a great development stack that makes it easier to manage dependencies while keeping a clear structure. However, I often use Advanced Custom Fields PRO which is not available on wpackagist.org as it is a paid plugin. So I made a search on Google and found the solution to add the package via Composer. Here is how to…

EDIT: You can also use this plugin https://github.com/PhilippBaschke/acf-pro-installer as an alternative to the below as per Philipps comment.

Add Advanced Custom Fields PRO to composer.json

Open composer.json and in the repositories array add the following object.

You can find your unique URL on your account. Just copy the download link as shown below.

acf-download-link

In composer.json you also want to add the following line to the require object

Remember to match the version number.

Save the file and run composer install or composer update depending on your situation.

Upgrading to newer version

When I upgraded from Advanced Custom Fields PRO from version 5.3.8.1 to version 5.3.9.2 by updating the version in composer nothing really happened. It just installed the same outdated version. This seemed to be due to some caching issue with composer. So I had to go back to Google and see how this could be solved. It turns out that it was quite simple. Just run the following command to clear Composer’s local cache.

You might also have to go to your plugins folder and remove the Advanced Custom Fields PRO plugin before you run composer update again. This should install the correct version of Advanced Custom Fields PRO.

4 responses to “Managing Advanced Custom Fields PRO with Composer

Leave a Reply

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