Hi Peter
Thanks for your speedy response. I have tried to follow the logic in the twig example:
add_action('elementor/query/related_av_solutions', function($query) {
$current_av_solution_id = get_the_ID();
if ($current_av_solution_id && get_post_type($current_av_solution_id) === 'av_solution') {
$connected_items = MB_Relationships_API::get_connected([
'id' => 'posts_to_av_solution',
'from' => $current_av_solution_id,
]);
if (!empty($connected_items) && !is_wp_error($connected_items)) {
$related_post_ids = wp_list_pluck($connected_items, 'ID');
if (!empty($related_post_ids)) {
$query->set('post__in', $related_post_ids);
$query->set('orderby', 'post__in');
} else {
$query->set('post__in', [0]);
}
} else {
$query->set('post__in', [0]);
}
}
}, 10, 1);
But it just blows my PHP memory limit. Any further help would be really appreciated.
Thanks
Marcus