Filter: bricks/conditions/result
Filters the boolean result of a condition check. This filter is used to implement the logic for custom conditions or to override existing condition logic.
Parameters
Section titled “Parameters”$result(bool): The result of the condition evaluation.$condition_key(string): The key of the condition being evaluated (e.g.,user_role,my_custom_condition).$condition(array): The condition settings (containscompare,value, etc.).
Example usage
Section titled “Example usage”add_filter( 'bricks/conditions/result', function( $result, $condition_key, $condition ) { // Logic for custom 'is_weekend' condition if ( $condition_key === 'is_weekend' ) { $is_weekend = ( date( 'N' ) >= 6 ); $value = isset( $condition['value'] ) ? $condition['value'] : 'true';
// Check if condition value matches current state if ( $value === 'true' ) { return $is_weekend; } else { return ! $is_weekend; } }
return $result;}, 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.