Support

Account

Home Forums Backend Issues (wp-admin) ACF not saving values

Solving

ACF not saving values

  • Hi,

    im using latest version of ACF pro. On one website we are using more fields than normaly 14 fields in few tabs.

    On this page im using select for country flags (https://github.com/lipis/flag-icon-css).

    Everything is working fine, except for the flags, the value is not saving. Each time i come to post value is reseted => no flag is showing.

    I’m receiving this notices:

    
    PHP Notice: Undefined index: operator in .../advanced-custom-fields-pro/core/location.php:87
    
    PHP Notice: Undefined index: operator in .../advanced-custom-fields-pro/core/location.php:91
    

    Can you please help me?
    Thanks for your time! 🙂

  • What are the select values for the field? What are the field settings? Do you have other code associated with the field? The library you linked to is a CSS library so I don’t see how it relates to a select field.

  • The field is used to return country code.

    AF : Afghanistan
    AX : Åland Islands
    AL : Albania….

    On my page first few was working at the begining. As we added more field, this field is not updating. After refresh in post admin ill always end on same value. In case of new entry Afganistan, because its first in select. If i want edit old one it will stay on previous value.

    Rest of the fields is working fine.

    Screenshot of field setting: https://cl.ly/2R3Q0g272J1u
    Screenshot of frontend: https://cl.ly/0N0c013m1b0u

  • When you save the field group, do the new choices save in the field settings? Is this just a problem with the front end or the admin? I’m still not 100% sure of the problem. Do you have any caching plugins or applications running on the site?

  • All other fields than this select are saving values.

      I created new post
      Filled all values
      Saved
      All other field are fine but flags are not saved
      In backend on post page i see the defaul value on this select.

    This select is not saving any values. Thats why it’s not printing anything to frontend – i mean flags.

    We are not using any cache plugins etc on develop environment.

  • There is only one reason that I can thing of that the value is not saving, or maybe it is saving, but something is interfering with it. What is the name of the field? Is that field name duplicated anywhere?

    If you have another field with the same name then when ACF attempts to get the field key of the field associated with the select field it could be getting the field key for the other field. This other field probably has a value that’s not listed as part of the select field so it is reverting to the default value.

  • Field name was called “country_flag”, and i’ve tried more names. It didn’t work. I checked DB and data was to saved to post_meta. I was not using the same name anywhere.

    I made a copy (duplicated) the field and changed the name and it worked. Don’t know the reason, but it’s working.

    Thanks for ideas and your time!

  • It seems that post_name field in the database has to start with field_ in order for the frontend edit to work.

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

You must be logged in to reply to this topic.