How would I go about importing data from a spreadsheet/CSV into a CPT with ACF Custom fields?.
Basically I have a Retailers CPT and I would need to import the Post title, and two ACF TextArea fields.
I believe there are premium plugins such as WP All Import that would do this but they are rather expensive for such a simple one-off operation.
Is there not another way? Could I not import the data into the relevant database tables with PHPmyadmim or similar?.
Any help much appreciated.
If you’re just importing a couple of simple fields there are probably several free plugins that will do the job. I don’t know any off the top of my head because I’ve been using WP All Import for a while, but here is what you need.
1) Ability to import into custom post types
2) Ability to set custom fields an where they’re located in the spreadsheet
3) Ability to set custom fields to a specific value
3 is important because you’ll want to be able to set the field keys for ACF while importing the files. For example if you have a field named
my_textarea then you need to set the following custom fields during the import
meta_key | meta_value my_textarea | = value from spreadsheet _my_textarea | = acf field key, example: field_1234567890acb
As long as your just importing simple text values then any import tool that does this will work. This includes text, textarea, number, url, radio, email, password, single select fields.
For other types of fields you’ll need WP All Import Pro or some other premium plugin.
Thanks for your input. I did look at other import plugins such as: https://en-gb.wordpress.org/plugins/wp-ultimate-csv-importer/
But most of them seem to only import to standard wordpress custom fields and not ACF specific ones unless upgrading to the PRO version.
Perhaps there is another free one someone could recommend?
ACF custom fields are standard WP custom fields for the most part. The fields I listed above are no different in any way with the exception that there needs to be the field key reference.
IN WP All Import you can set specific custom field names and you can set them to a specific value.
The only time you’re going to run into a problem with ACF fields is places where it does not store information in the standard WP way. Examples of this would be image fields(ID of image stored), relationship fields (serialized array of post IDs), checkboxes (serialized array), multiselect fields (serialzed array), taxonomy fields (term IDs)
Let’s take a look at the standard custom field area when importing with WP All Import, I have attached an image. In the first entry I have entered the name of the ACF field and selected where to pull the data from the CSV file. The second entry is the ACF field key pointer entry, I have entered the field name that ACF uses for this and set the value to the field key for this field.
After this import is run this field will be imported into the correct ACF field.
I’d hazard a guess that using WP All Import I could very likely even import all the complicated fields without needing the ACF add on. All that would really be required would be to have an understanding of how ACF stores the fields and to build filters for WP All Import. The only real problem with the free version of WP All Import is that it will not import into custom post types, so this is a huge issue and requires purchasing the pro version.
If there was a free plugin anywhere that could reliably import all of the different ACF fields and into custom post types without the type of work that I’ve described that’s probably what I’d be using.
I’ve seen many discussions on this forum over the last several years about import tools and can’t say that there is a free one that will do the job I’ve described. As a matter of fact, I’ve never seen this concept mentioned or described. If I had time I would download and test several of the free plugins to see if any of them could actually do it.
Hope this helps you in your search.
WP Ultimate CSV Importer Pro is now able to import all field types of ACF fields. But if you just want to import only the Text area fields of ACF, it can done on the Free version itself using a simple tweek.
Yes, as John said ACF fields are standard WP Custom Fields for fields like Text and Text area and that’s help you to import Text and Text area of ACF fields through WP Ultimate CSV Importer Free.
So already you have your Text area fields in your Fields Groups of ACF. Install WP Ultimate CSV Importer. Format your CSV with the name of your ACF fields as the column header and the value for them in each post of the custom post type.
Now Import it into the WP Ultimate CSV Importer and Choose the custom post in the Import each record as field. Then in the Mapping section, go to WP Custom Fields Tab and Click Add custom fields. Add the custom fields in it with the same name as the ACF fields and map the required CSV header and then proceed with the import.
This will import the data to the required Text and Text Area fields of ACF.
When you import it in this way, you will find WP Custom fields also on the Custom Posts which you have to remove from Screen Options.
Hope this would be helpful to you or others who are looking to achieve the same 🙂
Is this possible the other way around? That is it possible to import data into ACF fields from a different source / CSV using this plugin? If so, please provide details. I have a custom field on the users from an old plugin and want to tranfer the value in the text field to a new ACF field I created. Would I need to export the user info somehow to get that value then re-import it as a CSV for ACF?
If both sites are pages using the same ACF fields, this plugin is helpful. This plugin exports data of pages, posts, and options and then imports.
You must be logged in to reply to this topic.
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!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.