Skip Navigation

[Resolved] I need the id that is created when relating two posts

This support ticket is created 2 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 reply, has 1 voice.

Last updated by manuelL-5 2 years, 3 months ago.

Author
Posts
#2428105

Tell us what you are trying to do?
I need the id por news many yo many post that is created when relating two posts with the function: toolset_connect_posts.
I want to retrieve the id of the new post
Example
$resultado = toolset_connect_posts('solicitud-productor', $entry['7'], $entry['5']);

Function
/*conectar post solicitud productor*/
add_action( 'gform_after_submission_7', 'solicitud_productor', 10, 2 );
function solicitud_productor( $entry, $form ) {
$idrelation = $entry['7'] + $entry['5'];
$resultado = toolset_connect_posts('solicitud-productor', $entry['7'], $entry['5']);

// Modify post author
$my_post = array(
'ID' => $resultado[2],
'post_author' => $entry['8'] //user post id
);
// Update the post into the database and save new Activity post ID
wp_update_post( $my_post );
}

#2428167

My issue is resolved now. Thank you!
i found the solution here
https://toolset.com/forums/topic/create-intermediary-post-many-to-many-relationship/