Home Forums ACF PRO A lot of weird things happening


A lot of weird things happening

  • I updated to v5.3.6.1 .

    Firstly I lost a few of my field groups however the values remain in the database attached to the user. I manually re-added the fields and although they are there I can’t seem to access them using the get_field function. The function returns null unless the fields were already existing and pre-populated before the upgrade. The update_field function is no longer working for these fields either which I am using to update the fields on form submission?

    Can anyone help? Is there some simple thing I am missing here or have all the api functions completely changed? I couldn’t see any differences in the docs or updates to the general functions? Everything was working before the upgrade.


  • Hi @aedandev

    Did you update ACF from version 4 to version 5? If you did, have you upgraded the database after the update? This page should give you more idea about it:


  • Is there a way to manually initiate this database update because we are using composer to handle the plugin updates which just basically replaces the files and doesn’t do a ‘traditional’ update in wordpress?

  • Hi @aedandev

    I’m not sure if the update from composer will trigger the upgrade notice or not, but I believe it should be. You can also try the solution in this thread: Please don’t forget to backup your site and database first before modifying the file and upgrading the database.


  • This seemed to work and imported my old fields across to the new setup.

    One final thing that is not working now is the way I am updating the fields previously.

    update_field(get_acf_key(‘dob’), $dobVal, ‘user_’ . $user_id);

    Has this changed? Also ‘get_acf_key()’ is a custom function which returns the key of the acf field e.g. ‘field_56ceaffe771d0’


  • I believe the syntax has changed to just pass the acf field name now? As that appears to work for me.

    update_field(‘dob’, $dobVal, ‘user_’ . $user_id);

    instead of

    update_field(get_acf_key(‘dob’), $dobVal, ‘user_’ . $user_id);

  • Hi @aedandev

    I’ve just tested it, and it was working as it should be. Maybe there’s something wrong with your custom get_acf_key() function. Could you please provide the key manually like the following:

    update_field('field_1234567890', $dobVal, 'user_' . $user_id);

    Where “field_1234567890” is the key of your field.


  • My get_acf_key() function looks like:

    function get_acf_key($field_name) {
    global $wpdb;

    return $wpdb->get_var(”
    SELECT meta_key
    FROM $wpdb->postmeta
    WHERE meta_key LIKE ‘field_%’ AND meta_value LIKE ‘%$field_name%’ ORDER BY meta_key DESC;

    I am aware this can cause problems if two fields have the same name however I am making sure that they aren’t on my end. And this helps with possible inconsistencies in keys between different environments which lets me just use the same naming. The problem is in the database there are now duplicates of the fields after running the import script from the other post. The duplicates don’t show in the backend however, only in the database. So the script appeared to import the fields into the new structure but left the old meta data still there. I am not sure what to do about this. It would be good if there was a manual update available that would update to the new version and clean the old data out.

  • I talked to whoever set the environment up here and we have define(‘AUTOMATIC_UPDATER_DISABLED’, true); in config which I think will fix the issue if I disable this. It should allow me to update. I will test this soon and let you know.

  • Hi @aedandev

    It seems that Elliot has stated that the update should be working correctly on the current version. If you can, could you please check again if the database upgrade is working when you update ACF using composer?

    Did you try to provide the field key manually in the update_field() function? If it worked, I think you can query the meta key by ordering it by the meta_id, so you always get the latest field key.

    If none of them are working, I believe the only option you have is deleting the keys manually. Don’t forget to backup your database before modifying it.

    I hope this makes sense.

  • I reverted my database back to v4 so everything is back to original. I followed the steps in ‘’ and all goes fine and I activate v5 but I am just never prompted to upgrade the database? Where should the prompt appear and what should it look like? All the update field information makes sense. Just would like to get a clean install to make sure I can replicate on the live environment without any problems when I decide to move that to v5.

  • I am using version of the acf PRO.

    Also I am using Version 4.4.2 of wordpress.

  • Hi @aedandev

    I’ve attached the notice I got for you. Could you please try to create a new WordPress installation (without composer) and try to update ACF in it?

    Hope this helps 🙂

  • Did the clean install and got the upgrade database option… Annoying! Not sure why I am not getting it.

  • I found a manual fix for anyone that is having the same problem and their plugins are handled through something external to wordpress.

    I basically activated the new version. Deleted everything that had appeared in the new version field groups. Run

    UPDATE wp_options SET option_value = ‘4.4.5’ WHERE option_name = ‘acf_version’

    on the database.
    Replace ‘4.4.5’ with whatever previous version you were running. Seems like a much easier solution than the manual edited script and runs through the actual update process expected by the plugin.

  • Hi @aedandev

    Thank you very much for the manual fix. I believe it will help other users who have the same issue.


  • I am just going with plan B (ie skip the upgrade), due to time constraints.

    After reading your links though, I’ll note I manage plugins with wp cli, which I *think* is just a wrapper for WP internals, but possibly there is a possum in the woodpile there.

    I’ll start a new thread if this crops up again.


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

The topic ‘A lot of weird things happening’ is closed to new replies.