• Is there a way of importing to the ACF relationship field, particularly when there’s multiple entries?

    I’ve got two post types, with Post Type A containing a relationship field to link to any number of entries from Post Type B. I’ve uploaded all of Post Type B already, with set ID numbers (so I can at least edit the CSV file for Post Type A to reference the IDs if needed)

    Thanks

    https://www.ads-software.com/plugins/really-simple-csv-importer/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Nathan Adams

    (@nathan-adams)

    Ok, so I’ve managed to write some Excel formulas that can generate the array of post-IDs in the format the relationship field saves as the meta_value, so that part of the equation is solved.

    Example:
    a:4:{i:0;s:4:"1027";i:1;s:4:"1028";i:2;s:4:"1046";i:3;s:4:"1047";}

    However when I import that, it adds that entire string as a single item within a whole new array, like:
    a:1:{i:0;s:60:"a:4:{i:0;s:4:"1027";i:1;s:4:"1028";i:2;s:4:"1046";i:3;s:4:"1047";}";}

    What’s going on there? How can I get it to update the meta_value exactly as entered in the CSV?

    Hey Nathan,

    I have sort of the same problem here – what is the formula you are using? Have you solved the second part of your issue? If yes, how?

    Thank you for your help!
    Otto

    I don’t know, if it is still relevant, but you shouldn’t generate the array, it is enough to use the ID of the related post.

    So if you want to “connect” post A with post B (ID: 16), then 16 is enough in the relationship field column, no need to use a:1:{i:0;s:2:”16″;}

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Import to ACF relationship field’ is closed to new replies.