When using the get_terms and trying to order the terms using the ‘order’ and/or ‘orderby’ does not work

does this code really get you the categories in the order you want?

$categories = get_terms( 'category', 'order=ASC' );
echo "<pre>";   
var_dump($categories);

for me, it does not. In fact, the following three produces the same output

Read More
$categories = get_terms( 'category', 'order=ASC' );
$categories = get_terms( 'category', 'order=DESC' );
$categories = get_terms( 'category', 'orderby=count&hide_empty=0' );

Though the codex ( http://codex.wordpress.org/Function_Reference/get_terms ) says order and orderby valid params!

What am I missing? Does the below code really work for you and produce different outcomes?

$categories = get_terms( 'category', 'order=ASC' );
echo "<pre>";   
var_dump($categories);
echo "</pre>";  
echo "<hr>";
$categories = get_terms( 'category', 'order=DESC' );
echo "<pre>";   
var_dump($categories);
echo "</pre>";  

Related posts

Leave a Reply