Filter: bricks/query_filters/custom_field_index_rows
Filter: bricks/query_filters/custom_field_index_rows
Section titled “Filter: bricks/query_filters/custom_field_index_rows”Filters the index rows generated for a custom field in the Query Filters system. This allows providers (like ACF, Meta Box) or custom code to handle how complex field data is indexed for filtering.
Parameters
Section titled “Parameters”$rows(array): Array of index rows. Each row is an associative array representing a filterable value.$object_id(int): The ID of the object (post, term, user) being indexed.$meta_key(string): The meta key of the custom field.$provider(string): The data provider (e.g.,acf,metabox).$object_type(string): The type of object (post,term,user).
Example usage
Section titled “Example usage”add_filter( 'bricks/query_filters/custom_field_index_rows', function( $rows, $object_id, $meta_key, $provider, $object_type ) { // Example: Index a custom serialized field if ( $meta_key === 'my_serialized_field' ) { $value = get_post_meta( $object_id, $meta_key, true ); // ... parse value ... $rows[] = [ 'filter_value' => 'parsed_value', 'filter_value_display' => 'Display Value', // ... other required fields ... ]; }
return $rows;}, 10, 5 ); Was this page helpful?