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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.