Troubleshooting
6 min read
First steps
- Turn on
WP_DEBUGandWP_DEBUG_LOGinwp-config.php. Every expression that fails is logged towp-content/debug.log:
[wpmcf] Variable resolution failed — "{{ 1 + 2 }}" — Unexpected character: +Failures are silent for visitors and editors; without debug the block is just empty.
- Test the expression on its own, in a template or with WP-CLI:
wp eval 'echo wpmcf_resolve_variables( "{{ glb.phone | default(\"missing\") }}" );'- List what the engine knows (names are lowercase):
$registry = wpmcf_variable_registry();
var_dump( $registry->getRegisteredNamespaces(), $registry->getRegisteredFilters(), $registry->getRegisteredFunctions() );The expression prints nothing
Cause | Check | Fix |
|---|---|---|
Syntax error |
| See Syntax. Common: arithmetic ( |
Negative number literal |
|
|
Unknown key |
| Check the key. Unknown names are empty by design; add |
An old key with a hyphen or a leading digit |
| New saves of such keys are refused ( |
The value is a password | A Password field or a password Global Data variable | Never available in a template. See Security. |
No object |
| Pass a context: |
| WooCommerce inactive, or the object is not a product | Use it only on product contexts. |
The block is too long or too deep | More than 1000 characters, 5 nested blocks or 32 levels | Split it into several blocks or move the logic into PHP. |
A function was called through another namespace |
| Functions are called as |
The braces show up on the page
The text printed as stored: the value was not evaluated.
Cause | Fix |
|---|---|
The post's author does not have | Have a trusted user save the value, or allow it with the |
The value is a comment field | Never evaluated. Use a post, term, user or options value. |
The text is inside a Group, Repeater or Flexible content field | Only top-level text values are evaluated. Put the expression in the group's own template text or read the sub value with |
The text is post content or a title | Core content is not evaluated. Use |
The text is read through REST, GraphQL, an export file or an admin list column | These show the stored text. |
The braces come out of a variable | A value that itself contains |
An Elementor widget is shown in the editor | Widgets that Elementor previews with JavaScript templates (Heading, Button) show the raw text in the editor. The live page resolves it. |
A block was never closed ( | Add the closing |
The output is the wrong value
Symptom | Cause | Fix |
|---|---|---|
A number is not formatted | The value is not numeric ( | Store plain numbers; format with |
|
| Store the value as text (a Text field, a Global Data text variable) |
| A value like | Store dates as |
|
| Use |
| Only the first comparison or ternary is read | Use |
|
| Read what you need with |
| The value is not a term value, and no | Use it in a term field value, or |
| They are evaluated each time | Do not use them on cached pages |
A date is in English | Dates use the site language (Settings › General) | Change the site language |
| Lists are printed joined by |
|
The output contains HTML or breaks my markup
Variable results are not escaped. In a template, escape at the output:
echo esc_html( wpmcf_resolve_variables( '{{ glb.company }}' ) );wpmcf_the_field() and [wpmcf_field] escape for you. In an expression use \| escape, \| esc_attr or \| strip_tags. See Security.
A page shows one person's name to everybody
The page must not be cached. The plugin already marks a front-end page that prints a wp.user_* variable as not cacheable (DONOTCACHEPAGE and no-cache headers). If your cache layer ignores both (a CDN or a server-level cache), exclude that URL from it, or remove wp.user_* from the page.
My custom namespace, filter or function does nothing
Cause | Fix |
|---|---|
The | Attach it when your plugin file loads or on |
The resolver returns |
|
The name is taken or reserved |
|
The name has a dash or a leading digit | Names are letters, digits and underscores, starting with a letter. |
fn.option() returns nothing
The option is not on the allow-list. See Filters and functions. Add a safe public option with wpmcf/variables/allowed_options.
A hook does not fire
Cause | Fix |
|---|---|
Wrong number of arguments | Pass the fourth argument of |
Listener attached too late | Registration hooks ( |
The hook is a Pro hook on a free build or an unlicensed site | Hooks marked Pro in the reference exist only with Pro code and a license or trial. |
The hook name is a scheduled action |
|
| It is a hook you fire; the plugin only listens. |
The filter returns nothing | A filter must return the value. A missing |
To see every wpmcf/ hook firing during a request while you debug:
add_action( 'all', function ( $hook ) {
if ( str_starts_with( $hook, 'wpmcf/' ) ) {
error_log( 'hook: ' . $hook );
}
} );Still stuck
Open Settings › Health in the plugin: it lists errors the plugin caught, with the module and the file and line. See Health and troubleshooting.
Still stuck? Contact support