Hi, I’m using this code to to get only pages with certain template and it’s working fine, but results are all messed up since pages using the template have Parent and Child and I’m trying to order and group by parents, any idea how to achieve this?
function my_relationship_query( $args, $field, $post_id ) {
// only show children of the current post being edited
//$args['post_parent'] = 5915;
// show only pages with this special template
$args['meta_key'] = '_wp_page_template';
$args['meta_value'] = 'template-page-info.php';
// return
return $args;
}
// filter for every field
add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);