Sort post’s categories by ID

I have a blog in which several post’s categories have to be outputted first before other categories. Those categories have lower ID compared to other categories. I am using get_the_category_list but it is not working as I expected. Makes me confused because I remember a theme doing this very well. Can someone point me in the right direction? Thanks!

<?php get_the_category_list( array(
  'orderby'      => 'ID',
  'order'     => 'ASC'
) ); ?>

1 Answer
1

You’re using wrong arguments for get_the_category_list function. The function you should use for this is wp_get_object_terms http://codex.wordpress.org/Function_Reference/wp_get_object_terms

Leave a Comment