Facet type Number RangeAllow users to filter content based on a numerical field value.

Available options

Name Description
Data source Where the value lives (taxonomy, custom field, post attribute). If you also set an “Other data source”, this value will be used for the Min limit.
Other data source Use this setting if you want to use a separate value for the Max limit.
Compare type This setting is only relevant when the Other data source setting is in use. It determines how the range of the post’s two data source values is compared to the user-selected range. Note that for all compare types, <= and >= comparisons are used:

  • Basic – the post’s range is inside the user-selected range:
    Number Range facet compare type Basic
  • Enclose – the post’s range surrounds the user-selected range:
    Number Range facet compare type Enclose
  • Intersect – the post’s range intersects at least partially with the the user-selected range:
    Number Range facet compare type Intersect
Fields to show “Min + Max”, “Exact”, “Min”, or “Max”.

If you use two data sources, it is recommended to set this setting to “Min + Max”. If you choose “Min” or “Max”, only that value is compared. If you choose “Exact”, the comparison will use that value for both the upper and the lower limit of the user range.

Value storage and empty post range values

If a Number Range facet uses two data sources, the lower value is stored as facet_value, and the upper value is stored as facet_display_value in the index table.

There are a few things to keep in mind in this situation:

  • If a post has no value set for the first (main) data source field, the post will not be indexed, so it will never appear in the results. The same is true for posts that do not yet have this field set in the database because they have not been saved after adding the custom field in (for example) Advanced Custom Fields.
  • If a post has no value set for the second data source field, or if that field has not yet been saved for the first time, the post will be indexed but the value for the post’s range upper limit will then be set to 0. This may lead to unexpected or illogical results, depending on the “Compare type” you have set for the facet.

To prevent the above situations, make sure that if you use two data source fields, all posts actually have two values set.

Empty Min or Max fields

What happens if a Number Range facet uses two data sources, and a user does not enter a value into the “Min” or “Max” field? It depends on the “Compare type” you have set:

  • If the facet’s “Compare type” is set to “Basic”, only the field which has a value entered is used in the comparison.
  • If the facet’s “Compare type” is set to “Enclose” or “Intersect”, an empty “Min” field will be compared as -999999999999 and an empty “Max” field as 999999999999. Note that in this case, setting “Enclose” as “Compare type” will lead to 0 results, as the post’s range will never surround these user range values.

Translate the placeholder texts

The Number Range facet type currently does not yet have a setting to change the placeholder texts. You can translate the placeholder texts with a translation plugin like Loco Translate, or with the gettext WordPress filter by adding the following code to your (child) theme’s functions.php:

add_filter( 'gettext', function( $translated_text, $text, $domain ) {
  if ( 'fwp-front' == $domain ) {
    if ( 'Number' == $translated_text ) {
      $translated_text = 'Enter a number';
    } elseif ( 'Min' == $translated_text ) {
      $translated_text = 'Minimum';
    } elseif ( 'Max' == $translated_text ) {
      $translated_text = 'Maximum';
  return $translated_text;
}, 10, 3 );

See also