Filter: bricks/query_filters/index_post/meta_exists
Determines if a custom field (meta key) exists for a specific post during the indexing process. This is used when a third-party provider (like ACF or Meta Box) is selected, to avoid indexing empty or non-existent fields.
Parameters
Section titled “Parameters”$exists(bool): Whether the meta key exists. Default isfalse.$post_id(int): The ID of the post being checked.$meta_key(string): The meta key of the custom field.$provider(string): The data provider (e.g.,acf,metabox).
Example usage
Section titled “Example usage”add_filter( 'bricks/query_filters/index_post/meta_exists', function( $exists, $post_id, $meta_key, $provider ) { // Example: Custom check for a serialized meta field if ( $meta_key === 'my_serialized_data' ) { $data = get_post_meta( $post_id, $meta_key, true ); return ! empty( $data ); }
return $exists;}, 10, 4 );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.