Workflow Variables > Documentation  > Workflow Variables  > Workflow Variables

Workflow Variables

When you configure actions and triggers in a workflow, you can specify special variables in the trigger and action setting fields. These variables enable you to get actual values during the execution of the workflow.

All workflows have access to global variables, special built-in WordPress variables, variables generated by the workflow, custom-defined lists, and PHP constants. All variables are populated with real values during the execution of a workflow. Using variables in actions and triggers enables a workflow to process actual, live values.

To specify a variable, you need to use a special syntax. A variable starts and ends with two curly brackets {} and the name of a variable is enclosed inside of them. All variable names are case-sensitive.

Any variable can have a single value like a string or a number or can have a complex value like a list with a set of values.

Example 1: {HOME} The home URL of the website.

Example 2: {USER.user_email} The email address of the currently logged-in WordPress user.

If a particular variable is a list and you need to get the value of an element, you need to specify the variable name with a key (index). The terms key and index are used interchangeably and mean the same thing – a reference to a single element in an array. Typically we use index when we refer to a numeric key. To specify a list key, you need to use dot notation. Every key is separated from the variable name with a dot.

Example 3: {USER.roles} This is a list of roles currently logged-in WordPress user has. We use dot because the variable USER contains multiple values; thus it’s a list.

Example 4: {$post.post_title} This variable contains the title of the currently displayed post. In this variable, we use the global WordPress variable $post, which is a list and contains various details about the currently displayed post. For instance, to get the content of the post, use the variable {$post.post_content} respectively.

Note: all variable names and list keys are case-sensitive.

Variables available in a workflow

Note: a variable can contain a string, number, list, or a Boolean logical value that has two values: false and true.

Data generated by a workflow trigger.
Arguments passed to the workflow by WordPress, a parent workflow, or any other calling party.

If you want to create a workflow that filters out a value passed by WordPress, you can get that value by using variable {ARG.0}. Read more: Using workflow as a WordPress filter.

Data generated by the first action in the workflow. This data is a result of the execution of the first action.
Data generated by the previous action in the workflow. This data is a result of the execution of the previous action.
The list containing information pertaining to the currently logged-in WordPress user. For instance, to get the email address of the current user, you need to use the variable {USER.user_email}. You can use it, for instance, to send a notification to the user by using actions like Send email.

Read more on {USER}

Current date and/or time formatted according to the given format string. Example: the variable {DATE[F j, Y, g:i a]} returns string March 10, 2020, 5:16 pm. Read more about formatting dates and time:
Technical details about client’s computer such as IP address {CLIENT.ip} and hostname {CLIENT.hostname}. If WP Cerber Professional is installed, it also contains the country name¬† {} and the country ISO code {} .
The home URL of the website without trailing slash. For instance, for our website, it returns the string:


Global PHP variables

To get the value of a globally accessible PHP variable, prepend its name with a symbol $ inside the curly brackets like this:{$post}. If a particular variable is a PHP array (a list in terms of workflows), you can to specify the index of an element with dot, e.g. {$post.post_title} to get the value of the element. For multilevel lists, use several keys separated with dots. Some useful WordPress variables are described here:

PHP Constants

To get the value of any PHP constant, prepend its name with % inside the curly brackets. For instance: {%WP_CONTENT_DIR} or {%WP_DEBUG} will return values of WP_CONTENT_DIR and WP_DEBUG constant respectively

Nested lists

A list can be a multi-dimensional or a nested list, meaning each element of the list contains another list. For instance, such kind of lists is generated by the Get list of post and Get list of files actions. In this case, to get the value of an element in the list, you have to specify a variable with two or more keys. For instance, {PREVIOUS.0.post_title} gives you the post title of the first post in the list generated in the previous action. The first element in a list always has a zero key. To iterate over a list you can use Iterate next action.


If you need to get the value of a variable without type conversion (typecasting), you have to specify only one variable of any kind in configuration fields of an action or a trigger. If you specify more than one variable or enter some text along with some variable, all variables will be converted to a string containing respective values.

Read more

The {USER} variable holds information pertaining to the currently logged-in WordPress user

What WooCommerce data and fields can be used in a workflow

No Comments

Sorry, the comment form is closed at this time.