I am attempting to build custom WP admin functionality, that takes form field data, in this case, two post ID's of a custom post type called "Player" and assigning these IDs to Post Reference fields in a custom post type called "Match". This is for a tennis website.
I know that historically, the data for post reference fields may have been stored in the post_meta table, but I now understand that for some time, this data is not kept in a set of Toolset specific tables. I would prefer to not to have to use a M2M relationship for this. If I know the Post ID for the match, and the Post IDs for Player 1 and Player 2, how can I programmatically insert these into the fields in the Match post?
I tried using "toolset_connect_posts", but to no avail.
Here is what my code looks like (I've removed checking and validation for brevity):
```
$player_1_post_id = 1234;
$player_2_post_id = 5678;
$post_data = array(
'post_title' => 'Match Player 1 vs 2',
'post_type' => 'match',
'post_status' => 'publish',
'post_author' => 1
);
// Insert the post
$post_id = wp_insert_post($post_data, true);
update_post_meta($post_id, 'wpcf-match-status', 'scheduled');
update_post_meta($post_id, 'wpcf-match-type', 'ladder-match');
// Set Post Reference Field values - THIS doesn't work, is there a way I can do this?
toolset_connect_posts( 'player-1', $post_id, $player_1_post_id );
toolset_connect_posts( 'player-2', $post_id, $player_2_post_id );
```
Thanks in advance.