Skip to main content
1 of 4

Drupal 8 delete field programmatically

I have upgraded a website to drupal 8 that I found a field created and I need to delete that field as it becomes useless.

Problem: The field becomes locked which prevents me delete it from the interface. I tried to delete it in code programmatically using field_purge_field BUt it didn't work.

Motivation: Edit the field settings to unlock and delete from the interface or delete it using field api.

The answer on that question didn't work as I need to catch one field and delete it how-to-properly-delete-fields-programmatically

Can any body provide an example to unlock the field or delete it using its machine name?

Thanks in advance