AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

Field Name case change does not reflect in DB #881

Open redstonescooter opened 8 months ago

redstonescooter commented 8 months ago

Describe the bug if you change a lowercase letter in the field name to the uppercase letter , it does not create new database row , essentially ignoring the change , leading to your data existing in the ACF tab in wordpress and being shown correctly , but being lost everytime you modify it for some post because the actual field name hasnt changed in the DB .

To Reproduce

  1. name the field exampleone
  2. put some value into it for a sample post
  3. change the field name to exampleOne
  4. change the value for sample post
  5. observe your data being empty on every load

Version Information:

lgladdy commented 8 months ago

ACF field names should be lowercase, never camelCase - as per the automatically generated names from labels.

Due to the way MySQL tables are usually case insensitive, modifying a field name after creation to change the case may result in this kind of unexpected behaviour, depending on your MySQL configuration. This is a MySQL limitation rather than ACF - although I will raise that we should warn not to use capitals in field names; however we need to find a way to do that without encouraging those who setup their sites original as capitalised to make them lowercase, or similar issues might occur.