<p>I'm not sure there's a simple way to add metadata to entries without messing with the database or writing your own workaround. But if you only care about the value not being visible in the CP, you can use the <a href="https://plugins.craftcms.com/incognito-field" rel="nofollow noreferrer">Incognito Field</a> plugin. It's just a regular plain text field that you can set to readonly or hide completely.</p>
<p>I solved a similar problem for a migration of an old Drupal site this way. Added a hidden field to keep track of the old node ID, this way we could map relationship fields easily in our migration script. The field will even stick around after the site is live, allowing us to redirect direct node links (<code>node/123456</code>) to the newly created entry.</p>
<p>Sidenote: If you develop in a separate environment from the staging/live site, <a href="https://craftcms.com/knowledge-base/deployment-best-practices" rel="nofollow noreferrer">which you should</a>, you don't have this problem. You can fill your database with dummy content all you want without it affecting the staging site, and you don't have to get rid of it when the site goes live.</p>

CC BY-SA 4.0
2021-11-26T19:21:35.000Z
Thanks. I develop locally of course, but sometimes you want to add the actual content to your local DB and then copy it to production on initial release. E.g if I am developing a blog, I would first auto seed some dummy posts - which will allow me to focus on design and structure rather than content -  do all the front-end work, and then, when I'm ready to deploy, delete them and replace with actual content, to avoid an empty blog on initial release.
Matanya
CC BY-SA 4.0
2021-11-26T18:59:48.110Z
2021-11-26T18:59:48.110Z
MoritzLost
<p>I am trying to add a <code>seeded:true</code> flag to dummy entries seeded during development, so I can automatically weed (delete) them later when I'm ready to save the actual live content.</p>
<p>I know I can create a field and associate with entry type, but that would not be not ideal as this is purely development metadata that should not be exposed to CP users or loaded when editing the entry, not even as a hidden field.</p>
<p>Is this type of schemaless behavior possible in Craft? If not I suppose I can add a nullable <code>metadata</code> column to the <code>entries</code> table and save as JSON, but would prefer to avoid a major change for a relatively simple problem.</p>

<plugin-development><meta>
Save metadata on entry without creating a corresponding field
# Save metadata on entry without creating a corresponding field

(Asked by: username_0 on 2021-11-26)

I am trying to add a `seeded:true` flag to dummy entries seeded during development, so I can automatically weed (delete) them later when I'm ready to save the actual live content.

I know I can create a field and associate with entry type, but that would not be not ideal as this is purely development metadata that should not be exposed to CP users or loaded when editing the entry, not even as a hidden field.

Is this type of schemaless behavior possible in Craft? If not I suppose I can add a nullable `metadata` column to the `entries` table and save as JSON, but would prefer to avoid a major change for a relatively simple problem.

**Tags:** plugin-development, meta


---

## 1 answers

### Answer by username_1 on 2021-11-26. Score: 2 | Accepted answer

I'm not sure there's a simple way to add metadata to entries without messing with the database or writing your own workaround. But if you only care about the value not being visible in the CP, you can use the [Incognito Field](https://plugins.craftcms.com/incognito-field) plugin. It's just a regular plain text field that you can set to readonly or hide completely.

I solved a similar problem for a migration of an old Drupal site this way. Added a hidden field to keep track of the old node ID, this way we could map relationship fields easily in our migration script. The field will even stick around after the site is live, allowing us to redirect direct node links (`node/123456`) to the newly created entry.

Sidenote: If you develop in a separate environment from the staging/live site, [which you should](https://craftcms.com/knowledge-base/deployment-best-practices), you don't have this problem. You can fill your database with dummy content all you want without it affecting the staging site, and you don't have to get rid of it when the site goes live.

> **Comments:**
> **username_0**: Thanks. I develop locally of course, but sometimes you want to add the actual content to your local DB and then copy it to production on initial release. E.g if I am developing a blog, I would first auto seed some dummy posts - which will allow me to focus on design and structure rather than content -  do all the front-end work, and then, when I'm ready to deploy, delete them and replace with actual content, to avoid an empty blog on initial release.  

---

