Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

$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>";  
share|improve this question
1  
The code you posted at the end does return categories in different order as it should. –  s_ha_dum Feb 6 '13 at 1:33
    
You are right. I tested it on on a fresh install and it does output the results properly. I think the theme that I'm using for the current site I'm working on has a filter that changes the default behaviour of this core API. I already asked the theme developer to see if they are involved with this. BTW, is there a way to see all the hooks and filters that the current theme is introducing? –  Average Joe Feb 7 '13 at 1:34
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.