One of the search terms entered to find this website reads “sample code to delete keywords in tridion”, which I do have a vb script for.
To run the script here’s what you need to do:
- Create a new page, component or template building block
- Paste in the code below
- Change the value of the variable strCategoryID to the TCM ID of your category
- Preview code to execute it
[% Dim strCategoryID : strCategoryID = "tcm:21-88-512" ' Call the function passing in the categoryID DeleteKeywordsFromCategory(strCategoryID) Function DeleteKeywordsFromCategory(categoryID) ' Get the Category object - TCM must be valid! Dim objCategory : Set objCategory = GetTomObject(categoryID) For each objKeyword in objCategory.GetItems(1024) ' 1024 is the item type for keyword Writeout "Deleting keyword: " + objKeyword.Title & "<br />" objKeyword.Delete Next End Function %]
Once ran, you should see something like this:
Obviously such a basic example could be performed using the GUI, but this could certainly be customised to delete a certain keyword from a category, rename a keyword, display a list of keywords etc.