Documentation

Custom Filters

Extend the logic validator with filters built from user meta, query variables, cookies, PHP functions and more.

Custom filters extend the logic validator with data your site already has — without writing a line of code. The manager lives on the WP Brain settings page.

Custom filters manager in the WP Brain settings page
The custom filters manager.

The filters are built from sources marketers and developers already use: form fields, URL parameters, cookies, functions and more.

Filter name

The name is the label shown in the rule builder's filter dropdown. Custom filters appear under the “Custom” section of that list.

Data sources

Choose where the validator reads the current value that will be compared in a condition:

User metadata

WordPress stores profile details as user metadata: first and last name, plus any custom profile fields added by plugins. Use this source to segment members and target users whose metadata matches your conditions.

Post metadata

WordPress stores custom fields for posts and pages as metadata, and themes or plugins use it to add details that change a post's layout and content. This source lets you control visibility based on those custom fields.

Query variables

Query variables describe the current page request. While WordPress queries a page or post, it stores details in the global query object; a filter with this source can read them. See the official WordPress query vars guide for available keys.

URL variables: $_GET

URL variables (query strings) are common in marketing links because they carry details such as campaign, source or product. Create a filter with the key you need and use it without any scripting.

For example, with https://example.com/?color=purple, a visitor arriving through that URL can be shown content based on the color value.

Form fields: $_POST

When a visitor submits a form, this source reads the submitted field values. Use it to display content based on what was entered.

PHP constant

Build conditions from defined PHP constants. See the WordPress constants overview and PHP predefined constants for details.

PHP function

Use any available function that returns a value and takes no arguments. This source is intended for WordPress conditional tags, but works with standard PHP or third-party plugin functions too.

PHP variable: $GLOBALS

PHP variables store values during the page request. If you know a global variable name, this source can use it. See the WordPress global variables reference for the available options.

Cookies and session

Cookies and sessions are widely used to track visitors across pages. This source lets you filter content using their stored values.

Environment variables: $_ENV

Environment variables are set by the server and can contain useful details about the visitor. Read the PHP documentation for more.

Server variables: $_SERVER

Server variables describe the current request: IP address, referrer and more. The full list is in the official PHP documentation.

Data types

After choosing a data source, tell the manager what type of value it returns:

  1. String
  2. Integer
  3. Double
  4. Date
  5. Time
  6. Boolean
  7. Version

See the condition builder documentation to learn how each type maps to comparators.

Data key

The key identifies the value inside the chosen source: an array index, object property, function name and so on. It also acts as the filter's ID among registered filters.

Builder actions

Each filter row has two actions: a blue button exports a single filter, and the red cross deletes it.

Below the list, three buttons handle the rest: green adds a filter, orange imports exported filters, and blue performs a bulk export of every filter as code for later import.