Skip to content

Instantly share code, notes, and snippets.

@rossberenson
Created September 13, 2019 14:19
Show Gist options
  • Save rossberenson/c40725474a338dff8ac40e3cd72bf9df to your computer and use it in GitHub Desktop.
Save rossberenson/c40725474a338dff8ac40e3cd72bf9df to your computer and use it in GitHub Desktop.
/**
* Filter taxonomy terms by term_order if term_order is specified
*
* @param string $orderby Method to order terms by
* @param array $query_vars The query
* @param array $taxonomies Array of taxonomies
*/
function filter_terms_order( $orderby, $query_vars, $taxonomies ) {
return 'term_order' === $query_vars['orderby'] ? 'term_order' : $orderby;
}
add_filter( 'get_terms_orderby', 'filter_terms_order', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment