# Remove Collection Field data from Entry when Field is deleted?

**URL:** <https://discourse.getcockpit.com/t/remove-collection-field-data-from-entry-when-field-is-deleted/1760>\
**Category:** Support\
**Created:** [January 4, 2021, 1:36am UTC](https://discourse.getcockpit.com/t/remove-collection-field-data-from-entry-when-field-is-deleted/1760 "2021-01-04T01:36:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [January 6, 2021, 2:23pm UTC](https://discourse.getcockpit.com/t/remove-collection-field-data-from-entry-when-field-is-deleted/1760/2 "2021-01-06T14:23:38Z")

</div>

It’s not a bug - it’s a feature, but I see the problem.

> [@pixelkarma](#):
>
> Is there a way to prune the collections to only store the active fields?

Keeping only active fields is probably a bad idea, because there are a lot of hidden fields, e. g.:

- meta info `_created`, `_modified` etc.
- localized fields with language code suffixes `title_de`
- auto generated slugs `title_slug`
- some addons create hidden meta fields, e. g. UniqueSlugs…

But there is a cli command to fix that behaviour.

```bash
cd /path/to/cockpit
php ./cp collection/removefield --collection <collection name> --field <field name>

```

```bash
cd /path/to/cockpit
php ./cp collection/renamefield --collection <collection name> --field <field name> --newfield <new field name>

```

See: [https://github.com/agentejo/cockpit/tree/next/modules/Collections/cli/collection](https://github.com/agentejo/cockpit/tree/next/modules/Collections/cli/collection)

Both cli commands change the contents in the database, but they don’t change the field definitions in your collection settings. So performing the simple step of renaming/deleting a field is a bit complicated, but the tools to handle visible and hidden fields are available.

---

_[View the full topic](https://discourse.getcockpit.com/t/remove-collection-field-data-from-entry-when-field-is-deleted/1760)._
