Skip Navigation

[Resolved] Post Relationships API

This support ticket is created 5 years, 5 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.

This topic contains 1 reply, has 1 voice.

Last updated by Focus on the Family 5 years, 5 months ago.

Author
Posts
#1308225

Tell us what you are trying to do?
We can't get toolset_get_related_post to return a related post ID.
Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
Is there a similar example that we can see?

function get_results_page ( $data ) {
$args = array(
'post_type' => 'custom-post',
'post_status' => 'publish',
'meta_key'=> 'wpcf-api-alias',
'meta_value'=> $data->get_params('id'),
);

$query = new WP_Query( $args );

$Post = $query->posts[0];

$EmailPost = toolset_get_related_post( $Post, 'custom-post-results-email' );

return array(
'post'=>$Post,
'post_meta'=>get_post_meta( $Post->ID ),
'email_post'=>$EmailPost,
);
}

//"email_post": 0

What is the link to your site?

It's under local development.

#1308235

My issue is resolved now. Thank you!