跳转到主要内容

wp acf json import

Imports field groups, post types, taxonomies, and options pages from a JSON file.

Description

Reads an ACF export JSON file and imports the items into the database, replicating the functionality of the import UI in the WordPress admin. If an item with the same key already exists, it will be updated.

Options

wp acf json import <file>

<file> (string) Required. Path to the JSON file to import.

Examples

Import from an export file

$ wp acf json import ./acf-export-2025-01-01.json
Imported field-group: My Field Group (group_abc123)
Imported post-type: Book (post_type_def456)
Success: Imported 2 item(s).

Import a single field group JSON file

$ wp acf json import ./group_abc123.json
Imported field-group: Product Fields (group_abc123)
Success: Imported 1 item(s).

Re-import to update existing items

$ wp acf json import ./acf-export.json
Updated field-group: My Field Group (group_abc123)
Success: Imported 1 item(s).

Import from acf-json directory file

$ wp acf json import ./wp-content/themes/mytheme/acf-json/group_abc123.json

Return

The command outputs each imported item with its action (Imported/Updated), type, title, and key.

Notes

  • The file must have a .json extension
  • Supports both single item JSON files and export arrays containing multiple items
  • If an item with the same key exists, it will be updated rather than duplicated
  • Options pages require ACF PRO
  • Invalid JSON or items without keys are skipped with a warning

Errors

Error Cause
File not found The specified file path does not exist
File must have .json extension The file is not a JSON file
Import file is empty or contains invalid JSON The JSON could not be parsed