Drupal - How to manually or programmatically delete a field?

You can also use drush to run field_delete_field(). Just run:

drush eval 'field_delete_field("yourfield")'

Wow creating a field takes like 2 seconds ... but if it crapped out, i guess it crapped out.

Since you dont know "where" it crapped out basically you'll have to look for the tables to be sure you clean out whatever IS there ...

  • Drop the tables field_data_FIELD_THE_NAME_YOU_GAVE_IT and field_revision_FIELD_THE_NAME_YOU_GAVE_IT.

  • Also in field_config and field_config_instance look for name keys (and the bundle keys) for the field + bundles you tied the named field to. Delete those entries in those 2 tables as well.

  • Clear your site cache.

Tags:

Entities

7