get_post_modified_time( 'U', true, $group['ID'], true ) ) { $sync[ $group['key'] ] = $group; } } // bail if no sync needed if ( empty( $sync ) ) { WP_CLI::success( 'No ACF Sync Required' ); return; } if ( ! empty( $sync ) ) { acf_update_setting( 'json', false ); // vars $new_ids = []; foreach ( $sync as $key => $v ) { // append fields if ( acf_have_local_fields( $key ) ) { $sync[ $key ]['fields'] = acf_get_local_fields( $key ); } // import $field_group = acf_import_field_group( $sync[ $key ] ); } } WP_CLI::success( 'ACF SYNC SUCCESS!' ); } } WP_CLI::add_command( 'acf', 'ACF_Commands' ); }