Filter: bricks/conditions/result
Filter: bricks/conditions/result
Section titled “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 page helpful?