Home › Forums › Backend Issues (wp-admin) › Find / replace on ACF wp_postmeta?
I initially setup a lot of content that references an ACF flexible content field called ‘standard_elements’. I’ve since changed the name of the field to ‘custom_content’. Now, all old entries to the database reference the old field name, and all new content references the new field name. Causing an issue pulling this data into the front end.
I now understand that ACF doesn’t delete or auto rename any database content when a field name change is made, but I was wondering if I could do a find / replace on the database via phpmyadmin.
Would this action break ACF (after all, it would only be bringing old ‘hidden’ content back into ACF’s gaze)? And if not, what is the best way to make this change?
Thanks,
Andy.
Found a relevant link. Is the process outlined by @elliot still best practice in ACF Pro? http://support.advancedcustomfields.com/forums/topic/best-practice-for-changing-custom-fields/
To paraphrase @elliot, [write SQL in phpMyAdmin to the tune of…]
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';
OK. I followed the instructions in the post linked above and it worked fine. I had to re-run the query for the likes of…
So if anyone can note the SQL code to include such additions, for future reference, it would be much appreciated.
Thanks,
Andy.

The only issue that you’re going to have with this solution is if 'old_field_name' is not unique. It will cause any field with the old name to also be changed. This is the main reason that it’s pretty much impossible to build field name changes into ACF and why it has never been done despite many requests.
The topic ‘Find / replace on ACF wp_postmeta?’ is closed to new replies.
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.