Hi there,
I'm trying to programmaticaly save repeatable field group.
I've read it's like a post relationship so i've tried to save it with the function "toolset_connect_posts" but it didn't worked
I can't find the code anywhere.
Could you help me with that ?
Thanks in advance,
Mat
Yes could you check with them for me ?
That's would be great as I'm stuck with this problem.
I choose to buy Toolset Types for this feature (field group).
So to do it programmatically you will need to follow the example below.
//Create a new RFG Item
$new_rfg = array(
'post_title' => 'New RFG Item Title',
'post_status' => 'publish',
'post_type' => 'slug_of_rfg'
);
$new_rfg_id = wp_insert_post( $new_rfg );
//Add Fields to the RFG
update_post_meta($new_rfg_id , 'wpcf-slug_of_field_of_rfg', 'value to insert');
//Now connect the new RFG to a Post
toolset_connect_posts('rfg_slug', $post_id_to_which_rfg_belongs, $new_rfg_id);