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

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

<p><code>Craft\Commerce_ProductModel and its behaviors do not have a method or closure named "unimformityMeasurement".</code> </p>

<p>Actually, even with <code>devMode</code> 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.</p>

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

CC BY-SA 3.0
2017-05-29T00:46:10.617Z
2017-05-29T05:42:01.257Z
2017-05-29T05:42:01.257Z
Jeremy Daalder
<p>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.</p>

<p>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).</p>

<p><strong>Is there a way to check in twig if a field is on a given section?</strong> 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.</p>

<p>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.</p>

CC BY-SA 3.0
2017-05-29T01:04:33.860Z
This isn't a direct answer to your question, but the [Inventory plugin](https://github.com/lindseydiloreto/craft-inventory) (disclaimer: I'm the author) makes it easy to see where fields are being used from an admin POV.
Lindsey D
<templating><craft-features>
How to check if a field exists on a section
# How to check if a field exists on a section

(Asked by: username_0 on 2017-05-28)

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.

**Tags:** templating, craft-features
> **Comments:**
> **username_1**: This isn't a direct answer to your question, but the [Inventory plugin](https://github.com/lindseydiloreto/craft-inventory) (disclaimer: I'm the author) makes it easy to see where fields are being used from an admin POV.  

---

## 1 answers

### Answer by username_2 on 2017-05-29. Score: 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).


---

