Support

Account

Home Forums General Issues Convert Regular Custom Fields To Advanced Custom Fields?

Solving

Convert Regular Custom Fields To Advanced Custom Fields?

  • I’ve imported some content with custom fields from an older WordPress site.

    The custom fields are not created with ACF, but I would like to use ACF moving forward from this point on.

    What would be the best option to convert the current custom fields to advanced custom fields?

    Any ideas/suggestions are very welcome.

    Thanks!

  • If you set the field names of the fields when setting up ACF to the name of the current custom field ACF will pick up the values the next time the post is edited.

    If you want to set them all to be picked up without editing each post then that’s a bit more work. Each field in ACF has two entries in the postmeta table.

    Let’s say that your field name is represented by $fieldname. The two custom fields that need to be saved are

    $fieldname = your value
    ‘_’.$fieldname = acf field key

  • Hello. I need to do the same as the OP. And I need to do it without editing each post. There are 364 of them. How can I update the two entries in the postmeta table automatically? Or could I use a database field mapping plugin or import plugin that would do such a thing?

    Thanks for any insight!

  • Sorry for the late reply, this is a very old topic.

    There isn’t any way to retroactively do this.

    All I can say is this. If the fields are basic fields that store only text data then creating a field group and fields with the same names will make everything work. ACF will automatically pick up these fields.

    If the field data is stored some other way, examples

    • Serialized Data (arrays and the like)
    • Standard WP meta fields that have more than one value
    • ID references to other WP objects
    • there could be others

    then this information cannot be converted without a lot of effort. You’d need to create some kind of a cron that would read through every post and read every one of the existing fields and then update the database and all fields to what ACF needs in the database. To be honest, doing this is not realistic.

    Another alternative might be to use WP All Export Pro and WP All Import Pro. It might be possible to export the content to an XML file of spreadsheet and then import and rearrange the data. This is probably the path I would try. http://www.wpallimport.com/

  • Is there no utility for this? I have the same issue with hundreds of posts. Would prefer a solution that does not require purchasing a plug-in without a guarantee of success?

  • I was able to solve the problem using SQL statements. I basically found the field id’s of the added fields in the metadata and added records to match them for fields that had not been updated. Was kind of a pain, but works.

  • Hi there

    I hope you can help me: ACF does not pick up the field names automatically.

    I’ve created ACF fields with identical names to my core wp fields. They are all text fields. I have set the field group to “product”, as they are all WooCommerce products.

    However, even if I save the posts, the ACF fields do not update. I’m using version 5.8.7.

    Any advice?

  • I beg your pardon – I just saw that the original fields had the first letter capitalized. I assumed that the fields were all lower case in the DB.
    I changed them and it worked perfectly! Thanks for posting this solution.
    Happy face!

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

The topic ‘Convert Regular Custom Fields To Advanced Custom Fields?’ is closed to new replies.