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 and I can't find the code anywhere.
Could you help me with that ?
Thanks in advance,
Mat
We have an internal ticket to improve the documentation for this.
It is not well explained, but where you would use the relationship slug, with repeatable field groups this is simply the slug of the RFG, so your code might look something like this:
//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 );
//Now connect the new RFG to a Post
toolset_connect_posts('rfg_slug', $post_id_to_which_rfg_belongs, $new_rfg_id);
Let me know if you have problems implementing that.