FacetWP – override search order

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

function fwp_search_orderby( $query ) {
if ( function_exists( ‘FWP’ ) && FWP()->facet->is_search ) {
$query->set( ‘orderby’, ‘title’ );
$query->set( ‘order’, ‘ASC’ );
}
}
add_action( ‘pre_get_posts’, ‘fwp_search_orderby’ );
{{/gist}}