Documentation

Condition Builder

The condition builder is the core of WP Brain. Learn how rule groups, AND/OR logic and comparators work.

The condition builder is the heart of WP Brain. It's where you define the rules that decide whether an element is shown.

WP Brain condition builder showing a page rule beside nested device and browser rules
A condition built from nested rule groups.

A condition is a group of rules linked by logical operators. It evaluates to true or false: when it passes, the wrapped elements are shown; when it fails, the content inside the next Else container is shown instead.

Logical operators

The rules in a group are connected by one of two operators.

AND — every linked rule and sub-group must be valid. In the main condition, a single failure fails the whole condition. Inside a sub-group, the same rule applies.

OR — only one rule or sub-group needs to be valid. Validation stops as soon as a match is found, and the same applies inside sub-groups.

The builder draws the relationships as a tree of connecting lines, so complex combinations stay readable.

Rule comparators

Every rule needs a comparator that checks the real filter value against the value you provide. The available comparators depend on the value type — numeric values accept more comparisons than booleans, for example.

WP Brain includes 22 comparators, covering almost every comparison you're likely to need:

Comparators available for each data type.
Comparator String / Version Integer / Double Date / Time Boolean
Equal Supported Supported Supported Not supported
Not equal Supported Supported Supported Not supported
In Supported Supported Supported Not supported
Not in Supported Supported Supported Not supported
Less than Not supported Supported Supported Not supported
Less than or equal Not supported Supported Supported Not supported
Greater than Not supported Supported Supported Not supported
Greater than or equal Not supported Supported Supported Not supported
Between Not supported Supported Supported Not supported
Begins with Supported Not supported Not supported Not supported
Doesn't begin with Supported Not supported Not supported Not supported
Contains Supported Not supported Not supported Not supported
Doesn't contain Supported Not supported Not supported Not supported
Ends with Supported Not supported Not supported Not supported
Doesn't end with Supported Not supported Not supported Not supported
Is empty Supported Not supported Not supported Not supported
Is not empty Supported Not supported Not supported Not supported
Is null Supported Supported Supported Not supported
Is not null Supported Supported Supported Not supported
Regular expression Supported Not supported Not supported Not supported
Yes Not supported Not supported Not supported Supported
No Not supported Not supported Not supported Supported

Some comparators take two values (“between”); others take none (“Is empty”, “Is not empty”, “Is null”, “Is not null”, “Yes”, “No”).

Built-in filters

WP Brain ships with a large set of filters. The possibilities are broad — you only need to find the right combination for your conditions.

  • Page: show content only on specific website pages
  • Page Template: show content based on page templates
  • Post Type: filter content visibility based on post type
  • Taxonomy: show content only in some taxonomy archives
  • Page Type: target archive, front page or blog pages
  • Pagination Number: show content on specific archive pages
  • HTTP Referer: target visitors arriving from a specific URL
  • Device: show different content on different devices
  • Operating system: control content for each operating system
  • Browser: control content visibility based on the visitor's browser
  • Browser version: control content visibility based on the visitor's browser version
  • Logged in: show content only for logged-in members
  • User: filter content by specific user IDs
  • Role: target members based on their role
  • Country: display content based on the visitor's country
  • Region: restrict content visibility to specific regions or states
  • City: restrict visibility based on the visitor's city
  • Continent: restrict content visibility to specific continents
  • EU Member: target visitors from the European Union
  • Latitude: restrict content by latitude
  • Longitude: restrict content by longitude
  • IP Address: restrict content visibility using the visitor's IP address
  • Date: show content for a specific date range
  • Datetime: show content for a specific date and time range
  • Time: show content during a specific time period
  • Minute: control the visibility of elements by the clock minute
  • Hour: control the visibility of elements by the clock hour
  • Day: control the visibility of elements by the calendar day
  • Day of week: control the visibility of elements by the day of the week
  • Month: control the visibility of elements by months
  • Year: control the visibility of elements by year