I've created a lot of blog articles and saved a bunch of tags for them programatically. Then I deleted all of these articles.
The problem is: all the tags are still existing.
I didn't found out how to remove them.
This will not work...
var content = Services.ContentService.GetById(1234);
var allTags = Umbraco.TagQuery.GetAllTags("BlogArticleTags", _culture).Select(x => x.Text);
content.RemoveTags("BlogArticleTags", allTags, _culture);
...with ID of corresponding DataType (based on Umbraco.Tags). Content is always null - and the initially created content doesn't exists anymore, so I have no ID to use.
It is strange that umbraco holds all these tags even with no corresponding content, or is there something I misunderstand?
In Umbraco 8 I believe you need to run this SQL query
delete from cmsTags where id not in (select tagId from cmsTagRelationship)
I am trying to work out all queries you need to run to stop the database from growing at all if you add and then delete content and empty the recycle bin and came up with these three queries
delete from umbracoLog
delete from umbracoCacheInstruction
delete from cmsTags where id not in (select tagId from cmsTagRelationship)
There may be more, but this works for my test system.
How to remove all tags (for not existing content)
Hi Folks,
I've created a lot of blog articles and saved a bunch of tags for them programatically. Then I deleted all of these articles.
The problem is: all the tags are still existing.
I didn't found out how to remove them.
This will not work...
...with ID of corresponding DataType (based on Umbraco.Tags). Content is always null - and the initially created content doesn't exists anymore, so I have no ID to use.
It is strange that umbraco holds all these tags even with no corresponding content, or is there something I misunderstand?
Any ideas how to solve this?
Thank you very much!
Peter
I've got it.
One have to empty the recycle bin.
This is not obvious and I want to suggest to put the not actively used tags in the recycle bin as well...
In Umbraco 8 I believe you need to run this SQL query
I am trying to work out all queries you need to run to stop the database from growing at all if you add and then delete content and empty the recycle bin and came up with these three queries
There may be more, but this works for my test system.
Can confirm that in Umbraco 10, the query still works
is working on a reply...