I am builing a search engine where I need to search in 2 different taxonomies and sort them by slug. I got this code to do so.
$search = sanitize_text_field( $_POST[ 'search' ] );
$content = '';
$terms = get_terms(array(
'taxonomy' => array('apartments','houses'),
'search' => $search,
'orderby' => 'name',
'order' => 'DESC',
'hide_empty' => true
));
Right now the result is:
- Apartment A
- Apartment B
- House A
- House B
and i would like it to be like that:
- Apartment A
- House A
- Apartment B
- House B
Any idea as I run out of at the moment ;) I would like to avoid JS at that moment.
A esuoH
? This ordering doesn't make sense, are the terms grouped together in some other way that isn't being shared?