Skip to content

Hooks and Filters

The plugin exposes action and filter hooks at every layer: the preset builder form, the settings tabs, the frontend render, and the product query.

Hook Args Fires
wb_ajax_filter_before_filter_fields $filters Before the field list renders.
wb_ajax_filter_fields $filters Once per field while the field rows render - this is where a preset gets its filters.
wb_ajax_filter_after_filter_fields $filters After the last field row.
Hook Args Fires
wb_ajax_filter_settings_tab_content $tab_id Renders one tab’s body.
wb_ajax_filter_before_admin_general_settings $wb_general Before the filtering-behaviour form.
wb_ajax_filter_after_admin_general_settings $wb_general After it.
wb_ajax_filter_before_admin_search_settings $wb_search Before the product-search form.
wb_ajax_filter_before_admin_search_option_settings $wb_search_scope Before the search-scope options.
wb_ajax_filter_after_admin_search_option_settings $wb_search_scope After them.
wb_ajax_filter_after_admin_search_settings $wb_search After the product-search form.
wb_ajax_filter_before_admin_customization_settings $wb_customization Before the appearance form.
wb_ajax_filter_after_admin_customization_settings $wb_customization After it.
Hook Args Fires
wb_ajax_filter_before_content none At the top of the filters container, before the title.
wb_ajax_filter_after_content none At the bottom of the filters container, after the last preset.
Hook Args Purpose
wb_ajax_filter_get_preset_filters $filters, $preset_id Change the filter fields a preset renders. Add new field arrays, remove existing ones, or re-order.
wb_ajax_filter_restrict_products $matched_products Restrict the products the search autocomplete returns.
wb_ajax_filter_restrict_terms $results, $taxonomy Restrict which taxonomy terms show as filter options in the preset builder.
wb_ajax_filter_custom_field_search_limit $limit (default 30) Change how many custom-field matches the search returns.
wb_ajax_filter_show_search $show_search (bool), $search_enabled (bool) Override whether (and where) the product search box renders. Default: it shows on the shop page and category/tag archives only, because the search submits against the WooCommerce product loop those pages provide.
wb_ajax_filter_settings_nav_groups $groups Declare or modify the admin settings navigation.

Add a badge next to a taxonomy filter’s title on the frontend:

add_filter( 'wb_ajax_filter_get_preset_filters', function ( $filters, $preset_id ) {
foreach ( $filters as &$filter ) {
if ( 'tax' === $filter['type'] && 'product_cat' === $filter['taxonomy'] ) {
$filter['filter_title'] = $filter['filter_title'] . ' (categories)';
}
}
return $filters;
}, 10, 2 );

Show the product search box on every page where the filters render, not just the shop and archive pages:

add_filter( 'wb_ajax_filter_show_search', function ( $show_search, $search_enabled ) {
// Only force it on when the admin has enabled search at all.
return $search_enabled;
}, 10, 2 );