Home Forums ACF PRO ACF Pro upgrade fails just the slightest


ACF Pro upgrade fails just the slightest

  • I updated from the latest 4.x ACF to ACF Pro, cause I wanted to 😉 And some extra development needed it.

    There is only one small issue – I made the upgrade per instructions, upgrade/backup of database.

    Everything seems fine, but there is only one field that causes problem. Everything else works as before.

    This row does not work, it did before:
    update_field(‘field_8’, $data[‘maxRent’], $ID);

    -> The line of code does not work at this time. I got plenty of update_field like this before and after in my php-file for the other fields. And ALL of them work. $data[‘maxRent’] has a value, and I have also set an hardcoded string here.

    But the value appears empty when retrieveing it, and setting it.
    I have assigned all fields to a custom post type, so they can all easily be altered in admin.

    But only this one field – field_8 makes no success in setting or retrieving nor in the admin or from the frontend-field.

    I have made some debugging, but I can not get down to the issue in fixing this one thing. Strange.

    Any experience from you people perhaps? I got like a couple of thousands entries made previously..

  • the field_8 is a plain simple Text field, and I got like many fields, causing no issues else where..

  • I might have made a discovery here, but am not sure.

    I got a field_8 used in another ‘Field Group’ as well.
    Must they be totally unique?

    I guess so?

    It worked with the 4.x ACF though, but the upgrade now might have thrown in some issued of course.

    So I got like this now:

    Galllery Field Group > img (field_8)
    Interest form Field Group > maxRent (field_8)

    How can I make the field_8 for the img gallery to be completely unique?
    Do I have to make changes in database, or is there a better way?

  • Is field_8 the field name or the field key?

    If it’s the field key, then yes the problem is because you have two different field types using the same key, these must be unique.

    If it is the field name, then the problem is that it starts with field_. Field names cannot begin with field_

  • It is the Field_Key unfortunately.

    I guess the newer versions of AFC has more random generation of the field_keys.
    I guess I would like to have a “database upgrade”/”upgrade” or a “Fix duplicated field keys”-button/function to solve this.

    Making a database-hack, and many manual steps to fix this does not seem like a solution that I would feel confident in. Even though I understand somewhat steps on how to achieve a fix.

    There should be an internal check which could be viewed within the admin about notices/warnings.

    I remember this as a problem earlier when importing/exporting ACF groups from places, or the need for duplicating etc etc.

    I wish this could be added some more checks in current version as well, especially when it comes to upgrades and other things like that 😉

  • Unfortunately, I don’t know of any way to easily fix the problem.

    If the field names are unique that would make it a little easier. Even here, if the field is part of a repeater or flexible content field it’s not going to be simple. The following SQL query would do the work. You’d need to swap out the table and field names to match your after changing one of the field keys.

    In the following

    acf_field_name = '_'.$your_field_name

    UPDATE wp_postmeta SET meta_key = "acf_field_name", meta_value = “new_field_key” WHERE meta_key = “OLD_acf_field_name” AND meta_value = “old_field_key”

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘ACF Pro upgrade fails just the slightest’ is closed to new replies.