Overview

A search box that automatically displays suggestions as you type. The content searched in can be a custom field, a taxonomy or a post type attribute.

The autocomplete facet is not a “true” search, it’s meant for searching short data items like Last Name or SKU’s of products, and is less suited for searching phrases like titles.

FacetWP Autocomplete facet type

Available options

Name Description
Data Source Where the values live (taxonomy, custom field, post attribute)
Placeholder text The default text that appears within the input box. Note: this text is translatable with the facetwp_i18n hook.

Customize the result limit

To show 20 results per search, add the following to your (child) theme’s functions.php:

add_filter( 'facetwp_facet_autocomplete_limit', function( $limit ) {
    return 20; // default: 10
});

Change the number of characters

By default, the Autocomplete facets starts searching when you enter 3 characters, and shows the text “Enter 3 or more characters”. If you want to change this number, add the following to your (child) theme’s functions.php:

// Replace "autocomplete_facet_name" with the actual Autocomplete facet name
add_filter( 'facetwp_render_output', function( $output, $params ) {
  $output['settings']['autocomplete_facet_name']['minChars'] = 2; // Default: 3
  return $output;
}, 10, 2 );

See also