Support

Account

Home Forums General Issues Moving theme function meta fields to ACF

Solving

Moving theme function meta fields to ACF

  • I’m moving some post meta fields from a theme functions file to acf.
    In acf I’ve named the fields to match the fields created in the functions file. The data appears in the admin, but not on the front end (being pulled in by get_field()). If I save the post the information will then show up on the front end. There are hundreds of post, so I’m looking for solutions to update all posts. I did notice in the database that the after saving a post there are now two meta keys _distributor_title(original) and __distributor_title(new acf).

  • Yes, the additional meta key is important, this is the ACF field key reference. Without this reference get_field() will not work, nor will many other ACF functions. There isn’t any way, simple or complex to add all of the correct field key references for all of the fields for hundreds of posts. Well I guess you could, but in my opinion it would take longer to make the changes in the DB than it would take to edit and save the posts.

    In the past ACF would get value from fields defined outside of ACF and the field key reference did not need to exist. Many changes and checks have been added to ensure that a field is actually defined by ACF to make the plugin more secure and the existence of the field key reference in is part of those checks.

    It might be possible to get the values using ACF if you use the field key instead of the field name, but to be honest I don’t know if this still works. If you use the field key when calling an ACF function it does not need to perform the action of looking for the reference in the DB.

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

You must be logged in to reply to this topic.