By zbricoleur on
I must be really dense today. I can't see any way (in the Drupal interface) to delete a CCK field. I see how you remove it from a content type, but I need to delete some completely, as my list is getting cluttered with "test" fields that didn't quite work out... TIA
Comments
Ditto!
I have the exact same problem.
would this help?
http://drupal.org/project/content_type_cleanup
content_type_cleanup cleans/deletes your content not field
content_type_cleanup cleans / deletes all your chosen content type nodes NOT the content fields
because there is no a paragraph of description or documentation what it exactly does it may lead you delete all your nodes on chosen
you might loose your precious content if you misunderstood this -I did
the name of the module misleads its function
a function which really does allow you handle and delete the custom fields still needed though
How to clean fields
I have the same needs...
Deleting from the database
I searched the CCK issues but couldn't find anything there. You can delete it from the database but you must be very careful to do so.
Before going into the database I think you should do these:
As you can see this is very error prune and you may miss something. Actually I am not sure if I miss anything above. So the more correct action to take is open a CCK issue at the project page.
Thanks heaps for this
Thanks heaps for this checklist, just what I was after.
You are welcome
After reading the later comments, may be if you do the first part (the actions before we move to the database), may be Drupal will allow you to remove it from the admin pages.
Use the CCK admin interface
Under "Administer" > "Content management" > "Content types" cliick edit for the content type you want to remove the field from. Then click the "Manage fields" tab. If the field can be removed it there will be a 'remove' link under 'Operations'.
Sometimes a field can't be
Sometimes a field can't be removed through the User Interface. This is very anoying.
So now I go to the url of the confirmation page for the removal of a valid field (ex.: admin/content/types/nodetypeofyourfield/fields/field_yourfieldsmachinename/remove), and I change the field's machine name with the one I want to delete as it appears in admin/content/types/fields. Of course, you'd better not use it anymore.
Advantage: no hack in the DB, the work is done by drupal.
Good luck.
EDIT.: As far as I remember, nodetypeofyourfield in the first url seems indifferent. Indeed, you could have no nodetype for your field to be assigned, you can still use any nodetype in your url, drupal will do the work. If not, please report!
Fixed in D7?
Thanks, worked perfectly for me. Is this fixed in D7?
Removal of cck fields.
It appears if you remove a field from all content types, the system removes it. That is probably why the field list doesn't have an actual delete button. Not intuitive, but it works.
This is in...
...6, or 5.x?
This removal method works in 6.14
Yes it will delete the field completely, but to remove the reference from every content type is tedious. A simple removal is needed. This would allow the ability to save these fields for later use as well.
Thats how i do it
$type = 'mytype';
$content = content_types($type);
if (count($content['fields']) > 0){
include_once('./'. drupal_get_path('module', 'content') .'/content_crud.inc');
foreach($content['fields'] as $key => $field){
content_field_instance_delete(array('type_name'=>$class->pcid,'field_name'=>$key));
}
}
Fill in the holes
Works with the latest CCK
Just change the number of
Just change the number of values (I don't know whether this is the right english translation) to number of fields you want. Now you've got the right number of fields, if you want to add another field just set the number of values back to unlimited.
As of Drupal 7
As of Drupal 7, running all current modules and core (as of April 15, 2011) you can delete a field using the drupal interface! Steps:
1) go to admin/structure/content types
2) select any content type that includes the field you are trying to delete
3) select the 'manage fields' tab at the top of the page
4) locate the field you want to delete and select that field (link text in the column 'field')
5) you will most likely come to a page called 'field settings' that has an error message at the top, something about not being able to change the field because data has already been entered into it
6) click the 'delete' tab at the top of that page
And that is that. Others have said this and take notice, deleting any field will lose you all of your information that was held in that field. Make sure you actually want to do this before you do it!
AMENDMENT: I just realized that although this removes the field from all of your content types, it does not remove it from the database.... which means that you just can't use that field name anymore....
If you're using Drush: >
If you're using Drush:
> field-delete yourfieldname
This completely deletes the field -- you can re-use the field name for another field if you like.
Here's your docs.
d7 only
This thread is d5 (but also applies to d6). The drush command field-delete requires D7. And of course in D7, the problem identified by this thread is no longer a problem :)
mah ham
Removing inactive fields from database in Drupal 6
Tread lightly when doing this, and backup your database beforehand. Make sure none of the inactive fields are used on other content types.
In drupal 6 there is a function content_field_instance_delete that deletes fields. If there are no remaining instances it will delete the column or table.
Hi, I have a non-node field I
Hi,
I have a non-node field I want to purge. I want to keep the field, but purge the values without having to go into the database.
It is a commerce-order field which is wrongly shown in test.
Is there no module to remove the values of a field within Drupal when the field is not attached to a node, but another entity?
Thanks a lot in advance for your reply!
greetings,
Martijn