Overview

This hook is needed to register/add custom facet types.

Parameters

  • $facet_types | array | An array of facet type objects

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

$facet_types = [ 'checkboxes' => new FacetWP_Facet_Checkboxes(), 'date_range' => new FacetWP_Facet_Date_Range(), 'dropdown' => new FacetWP_Facet_Dropdown(), 'hierarchy' => new FacetWP_Facet_Hierarchy(), //... ];

Usage

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_facet_types', function( $facet_types ) { $facet_types['map'] = new FacetWP_Facet_Map(); return $facet_types; });

Remove facet types from the admin settings

The facetwp_facet_types hook can only be used to add new facet types, not to remove facet types entirely.

However, if you use an is_admin() check, so that it only runs in the admin area, you can use this hook to prevent specificied facet types from loading in the facet settings page. The result is that these facet types cannot be selected when creating a new facet. Existing facets of these types will remain visible but will not be editable.

How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_facet_types', function( $facet_types ) { if ( is_admin() ) { // Remove these facet types from the admin settings $disabled_facets = [ 'autocomplete', 'slider', 'date_range', ]; foreach( $disabled_facets as $facet ) { if( isset( $facet_types[ $facet ] ) ) { unset( $facet_types[ $facet ] ); } } } return $facet_types; });

See also

Last updated: February 3, 2026