This support ticket is created 4 years, 2 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.
I need to filter on a relationship. Only Buildings connected with the Customer Group relationship named "Eiendomsspar" should be retrieved. Is it possible?
$posts = toolset_get_related_posts(
get_the_ID(), //Post to query by.
'replace-your-relationship-slug, //Slug of the relationship to query by
'parent', //Name of the element role to query by.
1000, //Maximum number of returned results
0, //Result offset
array( //Additional query arguments
'meta_key' => 'wpcf-customer-group',
'meta_compare' => '=',
'meta_value' => 'Eiendomsspar'
),
'post_object', //Determines return type
'child', // which posts from the relationship should be returned
'title', //orderby: null, 'title', 'meta_value', 'meta_value_num'
'ASC' // $order 'ASC' or 'DESC'.
);
Where:
- Replace "replace-your-relationship-slug" with your original post-relationship slug
- Replace "wpcf-customer-group" field slug if required with your original custom field slug
- Replace the meta_value if required.
Can you please try and check if the solution I shared help you to resolve your issue.