Skip to content
Get Bricks

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.

  • $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 (contains compare, value, etc.).
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 );