Created
April 16, 2020 17:39
-
-
Save mingodev/377b9c5932f801687a01a92b2e91acbb to your computer and use it in GitHub Desktop.
Hijack WP Query orderby
This file contains hidden or 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
add_filter('posts_orderby', function($order){ | |
return "DATE(mt1.meta_value) DESC"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://codex.wordpress.org/Plugin_API/Filter_Reference