Filter: bricks/query_filters/index_post/wcField
A specialized hook for indexing WooCommerce product fields (like price, stock status, rating) when a product is saved. This allows the Query Filters index to stay updated with WooCommerce product data.
Parameters
Section titled “Parameters”$rows(array): Array of index rows to be inserted.$post_id(int): The ID of the product (post) being indexed.$elements(array): Array of filter elements targeting this product.
Example usage
Section titled “Example usage”add_filter( 'bricks/query_filters/index_post/wcField', function( $rows, $post_id, $elements ) { // This filter is typically used internally by Bricks to handle WooCommerce fields. // However, you could hook into it to index custom WooCommerce product data.
// Example: Index a custom product property $product = wc_get_product( $post_id ); if ( $product ) { // ... generate index rows ... }
return $rows;}, 10, 3 );Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Please do not include passwords, license keys, or personal data. We store submitted notes to improve the docs.
Thanks for sharing feedback. We're using it to improve these docs.