In my stash partial, I have:

{!-- Custom Sidebar? --}
{if "{exp:stash:get name='custom_sidebar_text'}"}
  <section class="container">
    {if "{exp:stash:get name='custom_sidebar_title'}"}
        {exp:stash:get name='custom_sidebar_title'}
    {exp:stash:get name='custom_sidebar_text' random}
{!-- /Custom Sidebar --}

In my template I have this:

  {exp:stash:set parse_tags="yes" parse_conditionals="yes"}
    {!-- Several other stash variables --}

I’m getting a warning saying:

A PHP Error was encountered
Severity: User Warning
Message: Invalid EE
Conditional Variable: {if "
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Users/agarzola/git/wfgc/system/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 412

If I remove the outermost conditional tags in the partial ({if "{exp:stash:get name='custom_sidebar_text'}"} and '{/if}'), the markup is rendered perfectly, with the stash variables parsed as expected.

edited to add: This only happens when the custom_sidebar_text field contains a link (generated via Wygwam in this case). Take away the link on the edit entry form, save the page, and the error goes away.

1 Answer 1


This is because the hyperlink in your stashed variable likely contains double quotes, which is also the delimiter you're using to contain the conditional. So you're basically saying:

{if "<p>Here is my test <a href="http://url.com">with a link</a>.</p>"}

As you can see, this will lead to problems due to unescaped quotes.

Instead, use :not_empty (docs).

{if {exp:stash:not_empty name="custom_sidebar_text"}}
  • I don't think I would have EVER figured this out. Thanks!
    – kmgdev
    Commented Jan 26, 2016 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.