bricks_reindex_filters
Overview
Rebuild the Bricks query filter index tables to ensure accurate option counts and filter values. The filter index is a cached representation of filterable data that enables fast, accurate filter counts without running full queries on every page load.
The index can become stale after bulk content operations — importing posts, bulk editing meta fields, or adding/removing taxonomy terms. Running a reindex ensures all filter elements display correct counts and options.
Key Features
When to Use
After bulk editing taxonomy terms or custom fields across many posts
When filter counts appear incorrect or outdated
After creating multiple posts with bricks_create_post in a batch script
As a maintenance step during site deployment or content migration
Filter elements must exist on at least one page
Posts with taxonomy terms or meta fields must exist for the index to build from
When NOT to Use
There are no query filter elements on the site — reindexing has no effect without filters
As a troubleshooting step for non-filter issues
Parameters
filter_typestringoptionalall Values: all, taxonomy, custom_fieldCode Examples
Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12
Reindex all filters after bulk content import
After importing 100 products with taxonomy terms and price meta fields, rebuild the entire filter index.
// Reindex everything
bricks_reindex_filters({ filter_type: "all" });
// Or just taxonomy filters after adding new categories
bricks_reindex_filters({ filter_type: "taxonomy" });
// Or just custom field filters after bulk meta updates
bricks_reindex_filters({ filter_type: "custom_field" });Common Mistakes
Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935
Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48
Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Tips & Warnings
Run reindex once after bulk operations, not after every individual post creation. The reindex scans all posts, so running it once at the end is more efficient.
This is a server-side operation that may take a few seconds on sites with thousands of posts. It does not affect the frontend during execution.