Home Forums General Issues Move from PHP registered fields to ACF UI Reply To: Move from PHP registered fields to ACF UI

  • Sorry, I only scanned your code minimally.

    The first thing that I noticed in your code was this

    function register_field_group(.... 

    This function that you’ve created already exists in ACF and the first line of your code should be causing a fatal error trying to declare the same function more than once. I did not look at every field group, but @rgdesign is correct. The field groups that you are attempting to create in PHP do not look like they are correct to begin with. My suggestion here is to create a field group in ACF and export them to PHP to get a better idea of what they need to look like in ACF5. There are significant differences between ACF4 and ACF5. if the field groups in your code were originally done for ACF4 then they will need to be updated to work with 5.

    After registering your field groups as normal in ACF.

    $field_group = acf_get_field_group($group_key);
    $field_group['fields'] = acf_get_fields($group_key');
    $json = json_encode($field_group);
    file_put_contents($group_key.'.json', $json);

    This should create a file that can be imported. Like I said, once the group is imported you need to delete it completely from your PHP or otherwise disable php from registering the group.