Variables overview
3 min read
Variables are small expressions written between double curly braces: {{ glb.phone }}, {{ fg.product.price | number(2) }}, {{ wp.post_title | upper }}. When a text that contains them is read, every {{ }} block is replaced by its result and the text around it is kept as written.
Call us on {{ glb.phone }} - open since {{ sys.year | default('today') }}.
→ Call us on 555 0100 - open since 2026.The engine is deliberately small and safe:
- It is not PHP. Nothing you write is ever executed as PHP. An expression can only read data through a fixed set of namespaces, and transform it with a fixed list of filters and functions.
- It has no loops, no assignments and no arithmetic operators. It has comparisons,
&&,||and a ternary? :. - A block that cannot be evaluated renders as an empty string. The page keeps rendering. With
WP_DEBUGon, the reason is written to the PHP error log. - The result of a block is data, never code. A value that itself contains
{{ }}is not evaluated again.
The variables engine is part of the free plugin. Only the pseo namespace (Programmatic SEO page data) belongs to Pro.
What you can read
Namespace | Reads | Page |
|---|---|---|
| A Global Data variable | |
| A field value of a field group | |
| The current post, term and signed-in user | |
| Date and time, site URLs, site name, locale, WordPress version | |
| The current WooCommerce product | |
| Values your own code passes in with | |
| Columns of the data row behind a generated page (Pro) | |
| Not data: calls a function such as |
There is no user namespace. The signed-in visitor is read through wp.user_name, wp.user_email and the other wp.user_* names.
Where variables work
Where you type | Works | Notes |
|---|---|---|
Text-like field values (text, textarea, email, URL and any other field whose value is a string) | Yes | Only when the writer may use them. See Security. |
Field placeholder and field default value | Yes | Evaluated when the edit screen is drawn. |
Global Data values | Yes | Evaluated when the value is read. |
Elementor widget and element settings (headings, text, button labels, links) | Yes | Free. |
Programmatic SEO templates (Pro) | Yes | URL path, title, SEO texts, page content, structured data. |
Your own PHP, through | Yes | See PHP API. |
The full list, with the exceptions, is on Where variables work.
The {} button
On a post, user, term or options page edit screen, text, text area, email and URL fields show a small {} button next to the label. Clicking it opens a list of syntax examples (global value, field value, current year, today's date, post title, user name, WooCommerce price, filters, a function and a ternary). Clicking an example inserts it into that field's value at the caret. The same popover appears next to Default value and Placeholder in the field builder, and next to the value of a Global Data variable (there, clicking copies the example to the clipboard).
Quick tour
{{ glb.company_name }} a Global Data variable
{{ fg.products.price | number(2) }} a field value, formatted
{{ wp.post_title | upper | truncate(40) }} two filters in a row
{{ glb.tagline | default('Welcome') }} a fallback when empty
{{ sys.year }} the current year
{{ src.city == 'London' ? 'Capital' : 'City' }} a condition (values passed by your code)
{{ fn.concat(glb.first, ' ', glb.last) }} a function call
{{ fn.option('blogname') }} an allow-listed WordPress optionIn this section
- Variables overview (this page)
- Syntax: literals, paths, filters, operators, nesting, errors
- Namespaces: every name you can read
- Filters and functions: every built-in, with results
- Where variables work
- Security
- PHP API:
wpmcf_resolve_variables(),wpmcf_make_context(), extending the engine - Hooks reference: actions
- Hooks reference: filters
- Constants and configuration
- Troubleshooting
Related: Global Data, Developer API, Page builder integrations.
Still stuck? Contact support