php – get_terms with specific id order

Question

I have the specific query

$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
$isActive = 0;
$postTerms = get_terms( [
'taxonomy' => 'field',
'orderby' => 'id',
'hide_empty' => true,
   ] );
 foreach($postTerms as $postTerm) :
 ?>
 <?php if($postTerm->term_id == 1 || $postTerm->term_id ==  2|| $postTerm->term_id == 
 2):?>

This returns the fied in order 1,2,3.
I’m trying to return them in a specific order: 2,1,3
I don’t think I can use an array with get_terms, so I’m a little lost on the best way to do that.
Any little guidance would be much appreciated!

0
Tioneb 4 months 2022-04-18T16:46:23-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse