When you remove a field from Craft, the data itself doesn’t disappear. So removing i.e. an intro field from a section, if that intro field is still used in the template, that content will be output still on an entry.

Presumably this is intentional more than a bug so that Craft doesn’t have to go and re-save all of the entries in that section, which would probably cause the webserver to catch on fire (therefore I’m not going to write a plugin to hook into the save entry hook to clear it).

Is there a way to check in twig if a field is on a given section? The “if x defined and x|length” check passes because this data exists against the entry, even if the fields isn’t on the section.

I’m using a template for multiple sections that share a similar set of fields for a preview, and don’t want to replicate 99% identical templates.

  • This isn't a direct answer to your question, but the Inventory plugin (disclaimer: I'm the author) makes it easy to see where fields are being used from an admin POV.
    – Lindsey D
    May 29, 2017 at 1:04

1 Answer 1


I think you're running in to a caching issues here or you're not testing with devMode turned on perhaps.

I've just tested here and if I remove a field and reload an entry in devMode I immediately get an exception e.g.:

Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "unimformityMeasurement".

Actually, even with devMode off I get a 500 server error with the same information, so I am thinking that you're very likely hitting a cached result that is preventing you from seeing these errors.

(In my experience you are correct the data is still in the database though).

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.