WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
[FIX] Fields disappearing after clicking "Save Field" (12 posts)

  1. logikal16
    Member
    Posted 3 years ago #

    This is a 2-step fix.

    1. The author left out the "instructions" column. Run this SQL (replace wp_ with your prefix if needed):

    ALTER TABLE wp_acf_fields ADD COLUMN instructions text DEFAULT NULL;

    2. On line 63 of core/fields_save.php, change
    'save_as_cf' => $field['save_as_cf'],
    to
    'save_as_cf' => (int) $field['save_as_cf'],

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. WhyN
    Member
    Posted 2 years ago #

    Works!
    Thanks for the fix, been look for one for a long time!

  3. sparklyfresh
    Member
    Posted 2 years ago #

    I was wondering how I was going to fix this - perfect solution. Thank you logikal16!

  4. gluethje
    Member
    Posted 2 years ago #

    This did not work for me I got this message after running the SQL:
    #1060 - Duplicate column name 'instructions'

    I went ahead and changed the core/fields_save.php file as noted above, but I still cannot save a custom field.

  5. Jacob Dunn
    Member
    Posted 2 years ago #

    Awesome tip, logikal. Did the trick. Very surprised that such a massive error has been allowed to sit in the repository for so long. Especially given the fact that you've highlighted the error.

    Would have immediately uninstalled the plugin if it hadn't come with such high praise from an associate.

    Disclaimer, untested:

    For anyone installing from scratch, you should also be able to avoid having to edit the database if you edit core/update.php, and add the following at line 458:

    instructions text DEFAULT NULL,

    You'll have to do so before ever activating the plugin, but it's a bit less of a headache.

  6. eddts@hotmail.com
    Member
    Posted 2 years ago #

    All hail king logikal16. Thanks dude, you are a star!

  7. jbisenius
    Member
    Posted 2 years ago #

    Hello! I did the same as gluethje, and went even further and deleted the field, so I could readd it, which worked fine, but this didn't fix the situation. I still cannot seem to make my picture attached to a post stick... Any idea when this might be fixed, as I kind of need a solution quickly... :(

  8. geir
    Member
    Posted 2 years ago #

    This didn't fix it for me as I already had the instruction column and I don't have the 'save_as_cf' => $field['save_as_cf'], in my ACF code.

    This plugin started great, but now I'm just frustrated as the fields in my group gets deleted as soon as I try to edit the group.
    This is a major bug. I don't dare to even click the menu link on the live site.
    No other solution to this yet?

  9. Pickleburp
    Member
    Posted 2 years ago #

    To geir and anyone else, it appears that the author of the plugin (Elliot Condon) has made a fix in the official version of the plugin more recently. Line 63 has been updated to $data['id'] = (int) $field['id'];, and the "instructions" column has been added to wp_acf_fields in the DB.

    I'm still seeing the same issue, however. We built and tested this site extensively on one server, then moved it to a different server for deployment. The odd thing is, it worked fine before but now in a live environment it appears to delete the field when you save it (including Repeater Fields). I'm looking into the database right now but I believe it's either taking the data out entirely *or* its somehow disassociating the rows so that the DB is looking in the wrong place for the wrong fields?

    We also had to do the hack of commenting out line 78 in input_save.php from the core dir in order to save fields on the new server once we got it transferred.

    Anyone else come up with a solution or still seeing this issue?

  10. Pickleburp
    Member
    Posted 2 years ago #

    I found a fix.

    Go to http://blog.elliotcondon.com/news/advanced-custom-fields-v3-beta/ and download at least v. 3.0.0 beta 2, then overwrite the files in your existing folder (/wp-content/plugins/advanced-custom-fields/), back up your existing files into a separate folder, and then overwrite the existing files on your server with the newly downloaded version.

    Note: If you have paid for and downloaded Repeater fields and are currently using them on your site, the beta will fix previously known issues with fields disappearing, not being able to save data to posts, etc., *HOWEVER* any repeater data entered in the old system will no longer save to the database using the same methods, meaning it will no longer associate the data in the repeater fields with your posts.

    For example, we have data associated with certain templates using the repeater fields on a new site. We couldn't change the fields in the repeater field because it would empty the existing data. Using the update, we fixed that issue, but then I had to export the database, find the old fields, and re-enter each of them on the associated pages.

    A little bit of a hassle, but its fixed. Looking at the code, it looks like it should be a more permanent fix so we won't have to do this again in the future.

  11. billybitmap
    Member
    Posted 2 years ago #

    Thanks Pickleburp. Beta 3 seems to be working for me so far. :)
    (Just using true/false checkboxes at the moment.)

  12. kae_
    Member
    Posted 2 years ago #

    I found a fix to my problem, I noted it down in the bugs forum over at the author's site: http://support.plugins.elliotcondon.com/discussion/706/disappearing-data

    Hope this fix work for others with the same problem.

    Geir.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic