I’ve recently been working on a project that requires the import of data from a CSV sheet to ACF (Advanced Custom Fields) values for a CPT (custom post type). It’s been a frustratingly long journey, so I thought I’d share to make your life a bit easier.
In theory, it’s a super straightforward process, but in practice it’s a tad difficult if you’re not sure what you’re doing or how the data is manipulated by WPAI when attempting to import multiple checkbox values using WP All Import.
Here is a sample of the data I was attempting to import.
In ACF, I have a multi-checkbox field that has a checkbox for each of the listed items (bike, horse, ski, etc).
Originally, I formatted my spreadsheet with types of activities as the column name, and a 1 if that activity was to be checked. If you’re importing to a single checkbox, that works well, but not if you’re trying to import multiple checkbox values using WP All Import.
Checkboxes in ACF
In order to understand how to import, you’ll need to take a gander at how your field is set up in ACF. Here’s how my multi-checkbox is set up…
bike : Bike horse : Horse ski : Ski skate : Skate snowmobile : Snowmobile hike : Hike mountain Bike : Mountain Bike
The first bit of text is the value, and the second after the colon is the label.
value : label
Back to WP All Import
Now, if you have the ACF Plugin for WP All Import, this is gonna be easy. Here are the steps to make sure your checkboxes are imported as ‘checked’ when importing multiple checkbox values using WP All Import.
- Make sure the values in your spreadsheet match the values of the checkboxes you want to check.
- Add a list of all values separated by comma to the WP All Import field. Mine was: {activity1[1]},{activity2[1]},{activity3[1]},{activity4[1]},{activity5[1]},{activity6[1]},{activity7[1]}
- Import and verify that all boxes have been checked.
- Enjoy!
4 Responses
I’m having trouble importing selections into dropdown fields. For instance my ACF field looks like:
-1 : Select
60 : Residential
61 : Commercial
My field in WPAI for this looks like {propertype[1]} – this obviously doesn’t select anything when I import it; the field remains as “Select”. I’ve tried to add things like {propertytype1[1]},{propertytype2[1]},{propertytype3[1]}. Also, {propertytype60[1]},{propertytype61[1]} and with an underscore and probably a hundred other variations. Nothing is selected during the import. I’ve also tried to change the index {propertytype[60]}, but that wouldn’t make sense, that’s the index of the data I am importing. I’m thinking I need to write a function to iterate through the select fields based on the string within the imported data, but there is a strong lack of documentation in this area. Any ideas?
It’s hard to troubleshoot without having hands on it. That said, WP All Import’s support is top-notch. I’d suggest reaching out to them!
Hi! I’m trying to do exactly this but can’t get it to work. It’s importing into the database as ‘value,value,value’ which is very different to how ACF stores the data and the checkboxes aren’t checked? I have the ACF add on for WP all import but I’m not adding my equivalent of ‘{activity1[1]},{activity2[1]},{activity3[1]},{activity4[1]},{activity5[1]},{activity6[1]},{activity7[1]}’ in that section of the upload settings as there doesn’t seem to be anywhere to put it? Instead it’s going in Custom Fields section. Any pointers would be much appreciated!
That sounds frustrating. I wish I could help, but I haven’t played with this in some time. WP All Import support folks are incredible. You might consider reaching out to them!