I am using wp_list_categories to return (you guessed it) a list of categories within a custom taxonomy. The orderby
parameter accepts sorting by ID, name, slug, count, and term_group. Is there a way that I can custom sort the results? Ideally I could pass an array of category ID’s in the desired order, but obviously I’ll have to dig a bit deeper to get this sorted.
Leave a Reply
You must be logged in to post a comment.
There is an unused column, term_order, in the wp_term_relationships table that you can use to assign a custom order to the terms within your taxonomy. The order is set at 0 by default and it will take a custom query to get the order back and another solution to set the order.
Example query:
This would give you back an array of terms ordered by the custom order.