跳转到主要内容

wp acf json

Manages ACF JSON import, export, and synchronization for item types (field groups, post types, taxonomies, options pages).

Description

The wp acf json command provides CLI access to ACF’s Local JSON functionality, enabling automated workflows for version control, deployments, and CI/CD pipelines.

Available Commands

Command Description
wp acf json status Shows the sync status for ACF items
wp acf json sync Syncs local JSON changes to the database
wp acf json import Imports items from a JSON file
wp acf json export Exports items to a JSON file

Examples

# Show sync status for all item types
$ wp acf json status

# Sync all pending local JSON changes to database
$ wp acf json sync

# Import from a JSON file
$ wp acf json import ./acf-export.json

# Export all items to a directory
$ wp acf json export --dir=./exports/

# Export to stdout
$ wp acf json export --stdout

Requirements

  • ACF 6.8 or later
  • WP-CLI 2.0 or later
  • Options pages require ACF PRO

Notes

These commands replicate the functionality available in the WordPress admin UI, making them ideal for:

  • CI/CD deployments: Sync JSON files to database as part of your deployment pipeline
  • Version control workflows: Export field groups to JSON for commit to Git
  • Automated testing: Set up test environments with consistent field configurations
  • Multi-environment management: Move configurations between staging and production