Force search facet to return 0 results if the the minimum character limit isn’t met

mgibbs189

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

// Add this to your (child) theme’s functions.php

add_filter( ‘facetwp_search_query_args’, function( $args ) {
if ( strlen( $args[‘s’] ) < 3 ) {
$args[‘post__in’] = array( 0 ); // force no results to be returned
}
return $args;
});

{{/gist}}