Docs Vector ExpressionsReferenceModifier Reference FREE

Modifier Reference

Modifiers transform the output of an expression. They are applied using the pipe operator | and can be chained left to right.

{{ value | modifier_one | modifier_two arg="foo" }}

Note: Modifiers are the outermost operation in a pipeline. You cannot use dot notation to access properties on a modifier’s output (e.g., | get_post.title is invalid). Wrap in parentheses instead: (post.meta.id | get_post).title.

Positional vs. Named Arguments

Most modifiers accept both positional and named argument styles:

StyleExample
Positional| date "Y-m-d"
Named| date format="Y-m-d"

Modifiers supporting both styles and their argument names:

ModifierPositional index 0Positional index 1Named keys
dateformat stringformat
defaultfallback value
ifthen valueelse valuethen, else
mapkey stringkey
joinseparator stringglue
truncatelength (integer)suffix stringlength, suffix
trimcharacter maskchars
replacesearch stringreplacement stringsearch, replace
propproperty namekey

String Modifiers

upper / uppercase

Converts a string to UPPERCASE.

{{ user.name | upper }}
→ "JANE DOE"

lower / lowercase

Converts a string to lowercase.

{{ post.title | lower }}
→ "my post title"

upper_first / capitalize

Capitalizes the first character of every word in a string.

{{ post.meta.subtitle | upper_first }}
→ "Breaking News"

kebab

Converts a string to a URL-safe slug via WordPress’s sanitize_title(). Useful for generating CSS class names or URL slugs from dynamic values.

{{ post.title | kebab }}
→ "my-post-title"

truncate

Cuts a string to a maximum character length. Appends a suffix (default ) when truncation occurs. Length and suffix can both be passed positionally or via their named keys.

{{ post.excerpt | truncate 120 }}
{{ post.excerpt | truncate 120 '...' }}
{{ post.excerpt | truncate length=120 suffix='...' }}

trim

Strips leading and trailing whitespace. Pass an optional character mask positionally or via the named chars key to strip specific characters instead.

{{ post.meta.url | trim }}
{{ post.meta.url | trim '/' }}
{{ post.meta.url | trim chars='/' }}

replace

Finds all occurrences of a search string and replaces them with a replacement string. Supports positional or named arguments.

{{ post.title | replace 'Old' 'New' }}
{{ post.title | replace search='Old' replace='New' }}

esc_html

Explicitly escapes HTML entities in the output string.

{{ post.meta.user_input | esc_html }}

esc_attr

Escapes a value for safe use inside HTML attributes such as title, alt, or value.

{{ post.excerpt | esc_attr }}

raw

Marks a string as safe HTML, bypassing the default htmlspecialchars escaping path. Output is still filtered through wp_kses_post to strip dangerous tags like <script>.

{{ post.meta.html_content | raw }}

Use raw instead of triple-brace {{{ }}} syntax inside Gutenberg RichText — the triple-brace syntax is not supported there.

render

Recursively parses any {{ }} expressions found within the input string. Useful when expression strings are stored in post meta.

{{ post.meta.dynamic_template | render }}

Date Modifiers

date

Formats a date value using a PHP date format string. If no format is provided, the WordPress date_format site option is used as the default.

{{ post.date | date "F j, Y" }}
→ "February 24, 2026"

{{ "now" | date "Y-m-d" }}
→ "2026-02-24"

Logic Modifiers

default

Returns the provided fallback if the value is empty, null, or false.

{{ post.meta.subtitle | default "No subtitle provided" }}

if

The piped input value is treated as the condition. If truthy, returns the then argument; otherwise returns the else argument (or null if omitted).

{{/* Show label if badge_label is truthy */}}
{{ post.meta.badge_label | if then=post.meta.badge_label }}

{{/* Show label only if the user is logged in */}}
{{ user.is_logged_in | if then=post.meta.badge_label }}

match

Maps the incoming value to a corresponding output using named key=value pairs. Supports a built-in default argument as a fallback.

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

Numeric matching: match uses loose comparison, so an integer value like 42 will correctly match a string case key of "42".


Data Modifiers

get_post

Hydrates a WP_Post object from a post ID. Use parentheses to access properties on the result, or chain the prop modifier to avoid wrapping the whole expression in parentheses.

{{ (post.meta.featured_post_id | get_post).title }}

{{/* Equivalent using prop — useful in longer pipelines */}}
{{ post.meta.featured_post_id | get_post | prop 'post_title' }}

prop

Accesses a named property on the pipeline value after a data-hydration modifier like get_post or get_user. The property name is resolved through the same Context::access() resolver used for dot-notation, so alias mappings (e.g. titlepost_title) are fully supported.

{{ post.meta.featured_post_id | get_post | prop 'title' }}
{{ post.meta.author_id | get_user | prop 'email' }}

Tip: prop is the recommended alternative to wrapping the whole expression in parentheses when you only need a single property from the hydrated object.

resolve

Alias for get_post. Useful when the intent reads more naturally as “resolve this ID”.

{{ (post.meta.related_id | resolve).title }}

get_user

Hydrates a WP_User object from a user ID. Same pipeline limitation as get_post — property access via dot notation on the output is not supported.

{{ post.meta.assigned_to | get_user }}

get_meta

Fetches a single meta value by key from a post ID.

{{ post.id | get_meta key="custom_flag" }}

map

Extracts a specific key from every item in an array. Useful for arrays of associative data.

Note: map excludes WP_Post and WP_User objects for security — use get_meta for post-level data instead.

{{ post.meta.amenities | map key="label" | join ", " }}

Join Modifier

join

Joins an array of values into a string with a separator. Accepts the separator positionally or as the named glue argument.

{{ post.tags | join ", " }}
→ "WordPress, Gutenberg, Expressions"

Security & Protected Data

The engine proactively blocks access to sensitive data at the resolver level — these restrictions cannot be bypassed by the expression author.

Protected meta keys: Both post.meta property access and the get_meta modifier automatically deny any key that starts with an underscore (WordPress’s convention for private meta, e.g., _edit_lock) as well as explicitly sensitive keys like session_tokens.

User data restrictions: The user context proxy blocks access to database-prefixed role and capability keys (e.g., wp_capabilities, wp_user_level) to prevent leaking site-level permissions through expressions.

HTML output: All expression output is HTML-escaped by default via htmlspecialchars. The raw modifier bypasses this path but still runs through wp_kses_post — tags like <script> and <iframe> are stripped regardless.