Created
October 7, 2023 17:16
-
-
Save johnstonphilip/219bfe589d298f55c083473c097ff71f to your computer and use it in GitHub Desktop.
This will make posts get queried in order by the term_order defined for the post in the term_relationships table
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 my_order_posts_in_term_by_term_order( $orderby, $query ) { | |
global $wpdb; | |
return "$wpdb->term_relationships.term_order ASC"; | |
} | |
add_filter( 'posts_orderby', 'my_order_posts_in_term_by_term_order', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment