search ]

ACF Synchronized JSON: A Brief Insight into Its Functionality

I really love Advanced Custom Fields, and I’ve already written about it in the past. And although there are interesting alternatives for creating new content fields, in 99% of the cases, the ACF plugin in its PRO version provides everything I need as a developer for creating custom templates for clients.

Anyway, there’s a very useful little trick in ACF called ACF Synchronized JSON that some of you may not be familiar with. But before that, let’s go back to a time when this feature didn’t exist.

On that scenario, If I created a new field group in ACF and needed to transfer it to another WordPress installation, for example, if I was working in a development environment where I added new fields but didn’t want to perform a full database sync and only wanted to transfer those fields, I had to export and import that field group manually into the new environment.

If I needed to add one field, for example, to a specific field group, in most cases, I would do it manually in the new environment. Not that it wasted a lot of time, but it was definitely a hassle, especially if it involved a large number of new fields.

So, let’s get to know the ACF Synchronized JSON feature that solves this issue.

By the way, here’s an alternative called CMB2 for creating new content fields, but it doesn’t come with a convenient interface like ACF.

ACF Synchronized JSON

If you have the PRO version of ACF, all you need to do to use this feature is to create a new folder called acf-json in the root directory of your template. For security reasons, also add an index.php file to this folder with the following line:

<?php // Silence is golden. ?>

Now, every time you add fields or custom fields, ACF will automatically create a JSON file in the new folder you created. If you’re using Version Control like Git, you can now track the changes you made to ACF fields along with the changes you made to the template.

If you want to sync the fields to another WordPress installation, upload the mentioned folder to the new installation and look for an option called Sync Available when you go to Custom Fields > Fields Group in the WordPress admin interface.

Click on it, perform the synchronization, and you’re done.

Sync Available - ACF JSON

From now on, you won’t need to perform unnecessary database synchronizations or use ACF’s export/import functions.

 

Thanks to kristinfalkner.

0 Comments...

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development