Support

Account

Home Forums General Issues Best Practice for Changing Custom Fields Reply To: Best Practice for Changing Custom Fields

  • Hi @realph

    Flush values:
    http://support.advancedcustomfields.com/forums/topic/flush-unused-custom-fields/#post-9144

    The best way is to edit the field and change the field name. Next, access your DB via phpMyAdmin and write some SQL to look for the old field_name and replace it with the new field_name.

    The field name will bi found multiple times in the wp_postmeta table in the meta_name column.

    For each row in the wp_postmeta table, there is a second row containing a ‘reference’ from the value to the field object. This looks like an underscored version.

    So, to change both the field_name and the reference rows, you would write something like this:

    
    UPDATE wp_postmeta
    SET meta_key = 'new_field_name'
    WHERE meta_key = 'old_field_name';
    

    and

    
    UPDATE wp_postmeta
    SET meta_key = '_new_field_name'
    WHERE meta_key = '_old_field_name';
    

    Hope that helps

    Thanks
    E