So I'm setting my meta author tag this way:

<meta name="author" content="{% if seoAuthor is defined %}{{seoAuthor}}{% else %}{{globalSeo.seoAuthor}}{% endif %}">

seoAuthor is a field that only appears in some entrie's layout (blog posts). At first the field was on every entry, but I changed it later.

The problem is that the data on the entries that no longer have that field in their layout is still displaying.

So is it possible to only show fields that are currently in the layout of the entry ?

  • 1
    Are you caching and have you tried clearing your cache? Are you also able to edit your question to show how seoAuthor is set.
    – dmatthams
    Commented Sep 17, 2019 at 9:11

1 Answer 1


I figured it out. The problem was that the code that set seoAuthor on every template was still there. So even tho the field was removed from the layout, the db still contains that field, so is able to retrieve it.

The fix was to remove the code that set the variable in the templates, and now works as intended.

One thing that still confuses me is why craft still pulls the data if is not in the layout anymore.

  • Unless you totally delete the field Craft will save whatever content it had previously for that entry in that field. It's technically still available if you call the field in your template, but the field UI doesn't show when you publish or edit an entry.
    – kmgdev
    Commented Sep 18, 2019 at 22:34

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.