Home › Forums › General Issues › How to Upgrade Simple Fields to ACF 5 › Reply To: How to Upgrade Simple Fields to ACF 5
I would have to agree with @johnbarneson
You’re talking about rebuilding all of the templates and moving content. It will rarely be cost effective to make the change automatically or creating a import tool to do this when it will happen exactly 1 time. My experience is that it will take longer to build the tool, make sure it work and then use it than it will take so simply update the data manually.
If I had to do this on a budget and the number of fields was extremely limited I would
1) Create my new acf field groups.
2) At each location where a “simple field” was used I would see if the acf field has content and if not then use the existing simple fields code
if (get_field('some-field')) {
// data exists in the new acf field
} else {
// no data in acf field
// existing simple fields code here
}
3) The next step I would take is to add an acf/prepare_field filter for every acf field that needed to use the simple fields data. In this field I would test for a value in the field. If there is no value then I would get the simple fields field value. What this does it that it will copy any existing data when and if someone edits an old page.
4) As an added step I would create an acf/save+post action that deletes all the data stored by simple fields whenever a post us updated.
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.