diff --git a/functions.php b/functions.php index eabf779..20099a3 100644 --- a/functions.php +++ b/functions.php @@ -1,4 +1,17 @@ is_main_query() ) { + if ( is_search() ) { + $query->set( 'orderby', 'post_date' ); + $query->set( 'order', 'DESC' ); + } + } +} +add_action( 'pre_get_posts', 'my_search_query' ); // // Order search results by post_title