// Pre-select facet choices

Important: this tutorial has been re-written for FacetWP 3.0.4 and above.

Let’s pre-select audi if the current page URI is demo/cars and there’s no existing value for it.

add_filter( 'facetwp_preload_url_vars', function( $url_vars ) {
    if ( 'demo/cars' == FWP()->helper->get_uri() ) {
        if ( empty( $url_vars['make'] ) ) {
            $url_vars['make'] = array( 'audi' );
        }
    }
    return $url_vars;
} );

When a user visits http://yoursite.com/demo/cars/, Audi will be pre-selected 🙂