Last active
August 25, 2016 12:28
-
-
Save jchristopher/d15742b307f34b2dbd73 to your computer and use it in GitHub Desktop.
Customize SearchWP's main search query ORDER BY explicitly
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
<?php | |
// order by Post ID descending | |
function my_searchwp_query_orderby( $sql, $engine ) { | |
global $wpdb; | |
return "ORDER BY {$wpdb->prefix}posts.ID DESC"; | |
} | |
add_filter( 'searchwp_query_orderby', 'my_searchwp_query_orderby', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment