Home › Forums › General Issues › Bulk Importing Data with File Fields
Hello, I’m using the WP All Import plugin to mass import a lot of data. It works great, but I’m having an issue with file fields. I imagine the same thing would happen for image fields.
I have a field group set up with one field being a file. I have set it to be a file URL. When I do the import, the value for the file URL is imported correctly. And if I search for the meta_key / meta_value pair in the database, I see what I’d expect.
The problem is on the editing side of things. If you go to edit an imported record, the interface does not recognize that the file field has a value. The file itself is in the Media Library and, as noted, the value is listed in the database. So why doesn’t the file interface display the selected field?
Ah-ha. The plot thickens. One of the custom post type records file field had been edited to select a file, so that now if you go to the edit view, you do see a file selected there. If I search for that meta_key and that post_id in the database, I don’t any results. So are ACF file and image fields not stored in the wp_postmeta table?
Thanks.
I found it… The file is stored in the wp_posts table as a post_type of attachment and a post_parent ID of the record in question. I think I’m still missing something, though, because I still don’t see how it is tied to the field itself…
All right, I think I found all the connections…
We’ve got:
Hey guys.
Just as a tip, you can use the update_field
function (please see docs) to save a value to the post
All you need to do is save the attachment ID
Good luck!
The topic ‘Bulk Importing Data with File Fields’ 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.