Created
February 27, 2018 06:59
-
-
Save leurdo/8693534c6375c93418e5135330fc72b8 to your computer and use it in GitHub Desktop.
Move term to top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move_term_to_top( $orderby, $query_vars, $taxonomies ) { | |
if ( 'my_taxonomy' === reset( $taxonomies ) ) { | |
$orderby = "(CASE WHEN t.name = 'My Top Term' THEN 1 ELSE t.name END)"; | |
} | |
return $orderby; | |
} | |
add_filter( 'get_terms_orderby', 'move_term_to_top', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment