Home › Forums › Add-ons › Repeater Field › I need help populating repeater field with WP All Import › Reply To: I need help populating repeater field with WP All Import
hi all,
i am doing this now for days and finally it worked out with ACF repeater field called “galleryx” which holds two ACF fields
1. “gallery_tags” a ACF Taxonomy field (return value term id)
2. “gallery_images” a ACF image field (return value url)
All work fine when done manyually on my Custom Post Typ “projekte”…also when inmporting as defined by you guys for example one projects adds up 8 image rows..all other project data is also fine if couting their proper rows…also the data seems to be saved like “tagname, tagname”, “imagefile-name” and so on. but just the image is emplty and tags are not checked..i think because its not converted into the taxonomies needed object / serialization etc.
this i my function:
<?php
add_action( 'pmxi_saved_post', 'soflyy_add_data', 10, 3 );
function soflyy_add_data( $id, $xml, $update ) {
// Parent field name.
$selector = 'galleryx';
// The field to be appended.
$subfield1 = 'gallery_image';
$subfield2 = 'gallery_tags';
// Only continue if my_repeater_data contains a value.
if ( $value1 = get_post_meta( $id, 'my_repeater_data_gallery_image', true ) ) {
$value2 = get_post_meta( $id, 'my_repeater_data_gallery_tags', true );
// Format data for repeater.
$row = array( $subfield1 => $value1, $subfield2 => $value2 );
// Add new repeater row.
add_row( $selector, $row, $id );
}
delete_post_meta( $id, 'my_repeater_data_gallery_image' );
delete_post_meta( $id, 'my_repeater_data_gallery_tags' );
}
?>
what do you think?
thanx so much
timo
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.