Orderby Latest Posts
-
Hi Mikko, I use the free version of Relevanssi. In the site editor, I have added the default search block as well as the post-loop block in the search template. I also embedded the following code in functions.php:
add_action( 'pre_get_posts', 'wpshout_pages_blogindex' );
function wpshout_pages_blogindex( $query ) {
if ( is_search() && $query->is_main_query() ) {
$query->set( 'post_type', 'post' );
$query->set( 'orderby', 'date' );
$query->set( 'order', 'DESC' );
}
}
When I have Relevanssi disabled, the newest or last modified posts are displayed at the top. But when I enable Relevanssi, the newest posts are no longer displayed. I have tried many Relevanssi filters, but unfortunately I just can’t get the most recently modified posts to show at the top. Can you help me?
The topic ‘Orderby Latest Posts’ is closed to new replies.