This solution works for importing posts using the plugin: WP All Import (WPAI).
Quick context: Advanced Custom Fields stores its field data in a way which requires more than just importing one field. You’ll find a lot of discussion around the search phrase “importing into Advanced Custom Fields doesn’t work until manually saving“.
If you are not dealing with imported data using WPAI, this solution won’t apply.
The solution is to set up two fields during import.
In this example, I’m dealing with importing albums, or, “releases”.
Let’s say you want to import date values into the field name “release_date“.
You would expect to see something like this:
This will successfully import the date value and you’ll see it when viewing the backend of the post. However, you attempt to call:
get_field('release_date');
No values will be returned, unless you manually save the post. Then it’ll show up.
Since you’re using an import tool in the first place, seems likely that manually saving all posts isn’t feasible.
All you need to do is add another import field where the Name is the (hidden) field name and the Value is the field key.
That looks like this:
Run the import and you’re all set!
Did this work for you? Save you a bunch of time? Please let me know!
Leave a Reply