WordPress - Sort catergory by ID
5th June 2008
I’ve recently updated my WordPress install form an old unsupported development branch to the new one and found that the Category listing is now printed in Alphabetical order instead of the old ID based old method.
I have to say that I personally prefer the old ID sorting mode, it’s better suited to my own blog needing, so I browsed the codex and the forum to find a solution to put it back to the previous mode.
I found a couple of plugins that can do the trick but they’re not the way I was looking for.
Then I found this a very simple method by MichaelH; it only needs a small change editing one of the WordPress files and it works like a charm on every versions, as far as I can say.
Here it is:
open the “category-template.php” file
change
usort($categories, '_usort_terms_by_name');
to
usort($categories, '_usort_terms_by_ID');
The complete article is available here: the_category sort by ID






