Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pre-fill the search box if not filled
<?php
// Add to your (child) theme's functions.php
add_filter( 'facetwp_render_params', function( $params ) {
foreach ( $params['facets'] as $key => $facet ) {
if ( 'keywords' == $facet['facet_name'] ) { // change "keywords" to your actual facet name
if ( empty( $facet['selected_values'] ) ) {
$params['facets'][ $key ]['selected_values'] = 'circ';
}
}
}
return $params;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.