FacetWP – pre-select a sort option

mgibbs189

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

add_filter( ‘facetwp_preload_url_vars’, function( $url_vars ) {
if ( ’tilbudtest’ == FWP()->helper->get_uri() ) {
if ( empty( $url_vars[‘sort’] ) ) {
$url_vars[‘sort’] = ‘on_sale’;
}
}
return $url_vars;
} );

{{/gist}}