search ]

ACF Synchronized JSON: How to Sync Fields Without Exporting

If you’re working on WordPress projects with multiple environments – local, staging, and production – you know how frustrating it can be to keep Advanced Custom Fields (ACF) field groups in sync across them.

In this guide, you’ll learn how ACF’s Local JSON feature works, how to enable it, how to sync field groups between environments, and how to customize save/load paths for advanced workflows.

Local JSON has been available in the free version of ACF since version 6.0. You no longer need ACF PRO to use this feature. It works with field groups, post types, taxonomies, and options pages.

The Problem: Keeping Fields in Sync

Without Local JSON, transferring ACF field groups between environments requires either exporting and importing JSON/PHP files manually, or syncing the entire database. Both approaches are tedious and error-prone.

Even small changes – like adding a single field to a group – meant repeating that change manually on every environment, or doing a full database migration that could overwrite other data.

I’ve written extensively about ACF and rely on it for nearly every custom project. Local JSON solves this sync problem elegantly by turning your field definitions into version-controlled files.

What Is ACF Local JSON?

Local JSON automatically saves your ACF field groups as JSON files inside your theme directory. Whenever you create or edit a field group in the WordPress admin, ACF writes a corresponding JSON file. This means:

  • Your field definitions live in the filesystem, not just the database
  • You can track changes with Git alongside your theme code
  • You can deploy field changes by simply pushing files – no export/import needed
  • ACF loads fields from JSON files first, which is faster than database queries

Each field group is stored as a separate JSON file, named after the group’s unique key (e.g., group_abc123.json). The file contains all field settings, including sub-fields, conditional logic, and display rules.

How to Enable Local JSON

Create a folder named acf-json inside your active theme (or child theme) directory:

mkdir wp-content/themes/your-theme/acf-json

For security, add an index.php file to prevent directory listing:

<?php // Silence is golden. ?>

That’s it. From now on, any field group you create or edit will be automatically saved as a JSON file in this folder.

Always create the acf-json folder in your child theme, not the parent theme. Parent theme updates will delete the folder and all your JSON files. If you’re not using a child theme, use the acf/settings/save_json filter to save files to a custom location.

Syncing Fields on Another Installation

To reuse the same fields on another WordPress site:

  1. Copy the acf-json folder into the same theme directory on the new site (or push via Git)
  2. In the WordPress admin, go to Custom Fields > Field Groups
  3. If ACF detects JSON files that aren’t yet in the database, you’ll see a “Sync Available” tab
  4. Select the groups you want to sync and click “Sync”

Sync Available - ACF JSON

ACF marks a field group as “available for sync” when either:

  • The group exists in JSON but not in the database
  • The JSON file has a newer modified timestamp than the database version

Customizing Save and Load Paths

By default, ACF uses the acf-json folder in your active theme. You can override both the save path and load paths with filters:

add_filter( 'acf/settings/save_json', function( $path ) {
    return get_stylesheet_directory() . '/acf-json';
} );

add_filter( 'acf/settings/load_json', function( $paths ) {
    $paths[] = get_stylesheet_directory() . '/acf-json';
    return $paths;
} );

This is useful when you want to:

  • Store JSON files in a plugin instead of a theme
  • Load field groups from multiple locations (e.g., a shared library)
  • Keep ACF JSON files outside the theme for better separation of concerns

Since ACF 6.2, you can also use more granular filters to customize paths based on the field group key or type. See the official Local JSON documentation for details.

Local JSON vs PHP Registration

ACF offers two ways to define fields in code: Local JSON and PHP registration via acf_add_local_field_group(). Here’s how they compare:

FeatureLocal JSONPHP Registration
Editable in adminYes (changes saved back to JSON)No (fields are read-only in admin)
Requires code writingNo (auto-generated)Yes (PHP arrays)
Version controlJSON filesPHP files
PerformanceFaster than DB, slightly slower than PHPFastest (no file/DB read)
Best forTeams, iterative developmentLocked-down production fields

Most developers use Local JSON during development (for flexibility) and switch to PHP registration for production if they want to prevent accidental field edits.

Best Practices

  • Commit JSON files to Git: Treat them as part of your codebase, not disposable files
  • Don’t edit JSON files manually: Always make changes through the WordPress admin and let ACF regenerate the JSON
  • Use a child theme: Store the acf-json folder in your child theme to survive parent theme updates
  • Add acf-json to your deployment: Make sure your deployment pipeline includes the folder
  • Review diffs before merging: JSON diffs can reveal unintended field changes made by other team members

FAQs

Common questions about ACF Local JSON:

Do I need ACF PRO for Local JSON?
No. Since ACF 6.0, Local JSON is available in the free version. You can create the acf-json folder in your theme and start using it without a PRO license. The feature works with field groups, post types, taxonomies, and options pages.
What happens if the JSON file and database version conflict?
ACF compares the modified timestamp in the JSON file against the database version. If the JSON file is newer, ACF marks the group as "Sync Available" in the admin. You must manually click "Sync" to update the database. ACF never overwrites the database automatically, so there's no risk of losing changes without your knowledge.
Should I edit JSON files manually?
No. Always make field changes through the ACF admin interface and let ACF regenerate the JSON files. The JSON structure includes internal keys, hashes, and ordering that are easy to break with manual edits. If you need to define fields purely in code, use acf_add_local_field_group() in PHP instead.
Does Local JSON improve performance?
Yes. When Local JSON is enabled, ACF loads field definitions from the JSON files instead of querying the database. Reading a local file is faster than a database query, especially on sites with many field groups. The performance gain is small per group but adds up on complex sites with dozens of field groups.
Can I use Local JSON with a plugin instead of a theme?
Yes. Use the acf/settings/save_json and acf/settings/load_json filters to point to a folder inside your plugin directory. This is common when building a custom plugin that includes its own ACF field groups. Add the filters in your plugin's main file to override the default theme path.

Summary

ACF Local JSON turns your field groups into version-controlled files by automatically saving them as JSON in your theme’s acf-json folder. This eliminates the need for manual export/import and makes field deployment as simple as pushing code.

The feature is available in the free version of ACF since 6.0. To get started, create an acf-json folder in your child theme, and ACF handles the rest. On other environments, use the “Sync Available” tab to pull in field changes from the JSON files.

For production sites where you want to lock down fields completely, consider registering fields via PHP instead. For everything else, Local JSON strikes the right balance between flexibility and version control.

Join the Discussion
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 official logo