Home Forums Backend Issues (wp-admin) Field not saving when renamed


Field not saving when renamed

  • I created a clean test case for this:

    1. I add a Field Group for my custom post type “Movies”
    2. I add one custom field, text
    Field Label: Year of releaše
    Field Name: year_of_releaše
    (note the use of a foreign letter)
    3. The field works OK, but I realize I used a UTF-8 in a field name, so I go to rename it

    4. I rename the Field Name to year_of_release
    5. Now I cannot save the field anymore under “edit post” – whatever I put in there gets deleted when I press “Update” button
    6. Even if I delete this field from my Field Group and add it again, it’s not saving (it’s caching in some way)

    I tried this on a fresh WP 3.8.1, ACF 4.3.4 and CPT UI 0.8.2

  • Hi @enorog

    Are you able to edit your DB and remove the postmeta row where a value exists for year_of_releaše?

    Perhaps WP think this is the same as year_of_release and some sort of conflict is preventing the data from being saved…


  • Hi,

    this is how it looks in the database. It might be that your checking is stricter than WPs?

    Thanks for looking into it,

  • Hi @enorog

    Can you edit your DB and remove the postmeta row where a value exists for year_of_releaše?


  • Hi,

    I deleted the four rows in yellow in the attached pic DB1.

    The situation now:
    – ACF field name is “year_of_release”
    – when I edit an existing post, the field shows up as empty (doesn’t pick up string “Again” from the database)
    – when I type a new value in the existing post, the field saves OK – the database now looks like DB2 image (yellow fields are new)
    – when I add a new post, the field saves OK, the database now looks like DB3 image (yellow fields are new)

    I’m guessing the double fields are working and the single one (after rename) isn’t. After renaming my UTF8 character, it only saves a single field, so it isn’t working.

    Btw – why do the fields save twice in the DB? Post locking / versioning?


  • Hi @enorog

    ACF saves a reference value for each value. You can read more about this on the update_value documentation.

    I think we can agree that the issue was due to a database character encoding issue.
    I’ll add this to the to-do and look into it in the future.

    For now, can you please make sure all field names use english characters?


  • Hi,

    yes, I’m ok, this was more of a bug-report. I think the best solution would be to filter out these characters on the automatic js filling of the field (where you lowercase, replace spaces etc.). I would never intentionally use foreign characters in a field name, but when I’m filling the fields quickly I don’t always remember to check the generated field name.

    I have a script for my cms that does it while preserving the most common european characters – I’m attaching it.

    Thanks for your help!

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

The topic ‘Field not saving when renamed’ is closed to new replies.