Support Log in

36. ACF Migration

Developer Guide
Prefer video? Watch the Field Forge tutorials 8 short guides covering every feature Watch

Field Forge can import field groups and values from ACF Pro installations. The importer copies the data and does not delete the ACF field groups or values.

Detection Sources

  1. Database: acf-field-group and acf-field post types.
  2. Local PHP: Groups registered via acf_add_local_field_group().
  3. Local JSON: Group files of the ACF Local JSON feature, in the folders that ACF reads (acf-json by default).
  4. PostMeta: ACF reference keys in wp_postmeta. This source finds fields and values, no groups.

Detection tries the sources in this order and stops at the first one that finds groups. The source value in the result is database, local, json or postmeta.

php
$importer = FIELDFORGE_ACF_Import::instance();
$detection = $importer->detect();
// Returns: ['found' => true, 'groups' => 5, 'fields' => 47, 'posts_with_values' => 123, 'source' => 'database']

Group Import

php
$result = $importer->import_groups();
// Returns: ['migrated' => 5, 'errors' => 0, 'log' => [...]]

Before importing database-stored groups, Field Forge de-duplicates ACF group records by key/title and keeps the record with the most direct child acf-field posts. This protects migrations from old ACF databases where an empty duplicate group exists beside the populated group and would otherwise hide nested Repeater, Group, or Flexible Content children.

Value Migration

Values are migrated in batches of 50 posts at a time.

php
$offset = 0;
$total  = 0;
do {
    $result = $importer->import_values_batch( $offset );
    $total += $result['migrated'];
    $offset = $result['total_offset'];
} while ( ! $result['done'] );

echo 'Migration complete. ' . $total . ' values migrated.';

Field Type Mapping

ACF TypeField Forge TypeNotes
texttextDirect mapping
textareatextareaPreserves new_lines
numbernumberPreserves min/max/step
imageimagePreserves return_format
filefilePreserves return_format
wysiwygwysiwygPreserves toolbar settings
selectselectPreserves choices
repeaterrepeaterRecursive sub-field import; created only while the Pro add-on is active
groupgroupRecursive sub-field import; created only while the Pro add-on is active
flexible_contentflexible_contentLayouts and sub-fields; created only while the Pro add-on is active
linklinkPreserves return_format
google_mapgoogle_mapNative Google Map type (Free) — coordinates and address preserved
date_time_pickerdate_pickerThe field becomes a Date Picker, a date box without a time. The importer does not cut the time off the value (it is copied as ACF stored it), and the date box of the post editor reads only Y-m-d

—

Forge AI Assistant Online

Hi! I'm the Field Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs