Tell us what you are trying to do?
I try to create an email list as a shortcode with the help of "toolset_get_related_posts". The emails are stored in the parent posts of a related childpost. Through $id I can access the id of the child.
But somehow $child_posts does not return any results.
add_shortcode( 'email_liste', 'func_email' );
function func_email ( $atts ){
extract( shortcode_atts( array('id' => '', ), $atts ) );
  
//post_id
$id = $atts['id'];
   
$child_posts = toolset_get_related_posts($id,'selbstportrat-reitanlagen','child',999,0,array(),'post_id','parent');
 
   
//if it returns some posts
        if( $child_posts){
  
$emails = "Test , ";
  
            //now get the single posts fields values 
            foreach( $child_posts as $single_post ){ 
   
                //get each Posts post data
                $single_post_data = get_post($single_post);
                //get each ID
                $single_post_id = $single_post_data->ID;
                                //get each posts field value
  
  
$email = get_post_meta($single_post_id, 'wpcf-covid-19-benutzerprofil-e-mail', true);
   
//we need to create a list BEFORE the if is closed and BEFORE the foreach is closed
$emails .=  $email . ',';
}
 
// Ignore duplicates
$emails = array_unique( $emails );            
        
           
}  
  
  
return $emails;
  
}
 
Is there any documentation that you are following?
https://toolset.com/forums/topic/post-relationship-query-with-toolset_get_related_posts/
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
Is there a similar example that we can see?
no
What is the link to your site?
hidden link
			
	 
	
 
		
			
	
	
	
			
			Hello,
I suggest you debug the custom PHP codes line by line, for example:
Replace this line from:
//post_id
$id = $atts['id'];
With:
//post_id
$id = $atts['id'];
var_dump($id);
Make sure it is outputting the correct post ID value