Tell us what you are trying to do?
I'm trying to get the language of a traduction and et an empty array.
I have terms (terme), languages (langue) and an intermediary post Translation (traduction).
When in a loop of traduction, I want to access the language info of the post.
$language = toolset_get_related_posts(get_the_ID(),array('traduction','langue'),'parent');
print_r($language);
It outpost an empty array and I wanted to have the ID of the given language.
Is there any documentation that you are following?
API Post relationship
What is the link to your site?
Staging
Thanks
Hi there,
Thank you for contacting us and I'll be happy to assist.
Can you please update your code as follows and see if it works:
$query_by_element = get_the_ID(); // ID of post to get relationship from
$relationship = 'traduction'; // relationship slug
$query_by_role_name = 'intermediary'; // $query_by_element is a intermediary in this relation
$limit = 100; // defaults
$offset = 0; // defaults
$args = array(); //nothing needed
$return = 'post_id'; // We want Post ID
$role_name_to_return = 'parent'; // We want parent. Change it to 'child' to get child relative
$get_results = toolset_get_related_posts(
$query_by_element,
$relationship,
$query_by_role_name,
$limit,
$offset,
$args,
$return,
$role_name_to_return
);
print_r($get_results);
Feel free to adjust the values as need and make sure that relationship slug is "traduction".
I hope this helps and please let me know how it goes.
regards,
Waqar
My issue is resolved now. Thank you!