Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sort get_terms, naturally
<?php
function sort_terms ( $terms ) {
$sort_terms = array();
foreach($terms as $term) {
$sort_terms[$term->name] = $term;
}
uksort( $sort_terms, 'strnatcmp');
return $sort_terms;
}
// Usage
$terms = get_terms('tags');
$terms = sort_terms($terms); // that was easy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.