Problem

I search in internet and cannot found solution to my problem. WordPress has any solution to order taxonomy by post. For example: I have hotels from different countries. If user enter to the hotel in Uzbekistan taxonomy should come firstly Uzbekistan than other countries.

<div class="left_widget">
    <h2 class="second_title"><?=pll__('Destinations')?></h2>
        <ul class="left_menu">
            <li><a href="<?=get_permalink( get_id_by_slug('hotels-'.currlang()) )?>"><?=pll__('All Hotels')?></a></li>
            <?
            $categories = get_terms('destination', 'orderby=rand&hide_empty=0'); 


            if($categories){

            foreach ($categories as $cat):
                            ?>
            <li><a href="<?=get_permalink( get_id_by_slug('hotels-'.currlang()) )?>?h-destination=<?=$cat->name;?>"><?=$cat->name;?></a></li>
                <?
                endforeach;
                }
                ?>
        </ul>
</div>

Read more here: Sort taxonomy by post


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: