Support

Account

Home Forums ACF PRO Rename the field without losing existing content?

Solved

Rename the field without losing existing content?

  • It appears that if I rename a field in ACF, the content remains in the originally named field.

    example,

    Old field > Logo
    Renamed to > Icon

    The image remains in the Logo field and does not appear in the icon field in the content.

    Hope that makes sense. Trying to clean up a bit.

    How can I rename the fields without losing the content?

  • You cannot just rename a field, as you’ve found and there isn’t a simple way to do this.

    There are two fields in the database that are associated with each field, not including group, repeater and flex fields.

    The meta keys for these fields are $field_name and '_'.$field_name. The first one contains the field value and the second one contains the field key index. All of these meta keys need to be altered to the new field name. A warning, if this field name is not unique site wide then trying to do this in the database will result it you loosing data for other fields with the same name.

    Since the field name is not seen, if you’re goal is to change the label so it makes more sense I would just change the label and leave the field name alone. Outside of dev for use in ACF function the name of a field really does not matter.

  • Thanks John! Very helpful. Appreciate your time.

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

You must be logged in to reply to this topic.