Docs Vector ExpressionsCore ConceptsExpression Syntax FREE

Expression Syntax

All expressions are enclosed in double curly braces: {{ expression }}.

Literals

TypeExample
String"Hello, World"
String'Single quoted'
Integer42
Float3.14
Booleantrue, false
Nullnull

Property Access

Use dot notation to access properties on data roots, with certain alias shorthands supported:

{{ user.name }}
{{ post.title }}
{{ post.meta.card_type }}
{{ site.name }}

In addition to dot notation, the engine supports bracket notation. This is essential for accessing properties using a variable key or keys that contain special characters:

{{ user.meta["my-meta-key"] }}
{{ post.meta["card_type"] }}
{{ post.meta[user.name] }}

Comparison Operators

OperatorMeaning
==Equal
!=Not equal
>Greater than
<Less than
>=Greater or equal
<=Less or equal
{{ post.meta.price > 0 }}
{{ user.roles[0] == "administrator" }}

Logical Operators

OperatorMeaning
&&AND
||OR
!NOT
{{ user.is_logged_in && post.meta.members_only }}
{{ !user.is_logged_in }}

Ternary Expressions

{{ condition ? valueIfTrue : valueIfFalse }}

Example:

{{ user.is_logged_in ? "View Dashboard" : "Sign In" }}

Arithmetic Operators

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Modulo
{{ post.meta.price * 1.1 + 20 }}

Grouping with Parentheses

To control the order of operations in complex logic or math, parentheses are fully supported:

{{ (post.meta.price + 20) * 1.1 }}

{{ (user.is_logged_in || post.status == 'publish') && !post.meta.is_private }}

String Concatenation and Interpolation

Use the + operator to join strings:

{{ "Hello, " + user.name + "!" }}

Inside a string literal, users can embed expressions directly using single curly braces:

{{ "Hello, {user.name | upper}!" }}

Modifier Pipeline

Apply transformations to a value using |:

{{ post.author_name | upper }}
{{ "now" | date "F j, Y" }}

Modifiers can be chained — they are applied left to right:

{{ user.name | lower | default "anonymous" }}

Modifier Arguments - The library supports both positional and named arguments:

{{ post.meta.card_type | match event="Workshop" course="Academy" | default "Resource" }}

See the Modifier Reference for the complete list.

Complete Expression Examples

{{ user.is_logged_in ? "Welcome back, {user.name}" : "Join us today" }}

{{ post.meta.card_type | match event="is-event" course="is-course" default="is-standard" }}

{{ post.author_name | upper }} • {{ post.date | date "F j, Y" }}

{{ ("now" | date "U") + 86400 * 5 | date "F j, Y" }}

Raw Output

By default, all output is HTML-escaped. To output raw HTML, use the raw modifier or the special syntax {{{ ... }}}:

{{ "<h2>hello</h2>" | raw }}
{{{ "<h2>hello</h2>" }}}

Of note:

  • {{{ }}} syntax is not supported in Gutenberg RichText — use the raw modifier instead.
  • This bypasses the default htmlspecialchars path. Note that it still runs through wp_kses_post to strip dangerous tags like
  • The editor preview will not show the raw output — it will show the escaped output.

Comments

Use the comment syntax to leave notes inside templates. Comments are stripped entirely from output — they never reach the frontend.

{{-- This block is only for premium users --}}
{{ user.meta.membership_tier == "premium" ? "Welcome back!" : "" }}

Escaped Braces

To output a literal {{ without triggering expression parsing, prefix it with a backslash:

\{{ this is not parsed }}
→ "{{ this is not parsed }}"

This is useful when writing documentation or code examples inside post content.

Code Block Protection

Expressions inside <code>, <pre>, and <kbd> tags are automatically left unprocessed. Additionally, certain block types — including Code, Classic, Preformatted, Custom HTML, Shortcode, and Verse — are fully excluded from expression evaluation. You can safely display {{ }} syntax in code examples without it being parsed.