Custom Sort Order for looping through Taxonomy

I’m looping through all categories for a custom post type.

What I’m trying to do is manually set the order for the loop by taxonomy id:

My current format is:

$categories =

get_terms( ‘product_type’,
array(
‘orderby’ => ‘term_order’,
‘order’ => ‘ASC’,
‘hide_empty’ => 0
)
);
foreach ($categories as $category) :

But I want to sort by taxonomy id. I have tried the following with no luck:

$categories =

get_terms( ‘product_type’,
array(
‘orderby’ => ‘include’,
‘include’ => array( 5, 6, 66 ) //exact order id I want
‘hide_empty’ => 0
)
);
foreach ($categories as $category) :

Read more here:: Custom Sort Order for looping through Taxonomy

Leave a Reply

Your email address will not be published. Required fields are marked *