Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Peter Aderhold 29 posts 201 karma points
    Nov 28, 2019 @ 12:26
    Peter Aderhold

    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...

    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?

    Any ideas how to solve this?

    Thank you very much!


  • Peter Aderhold 29 posts 201 karma points
    Nov 28, 2019 @ 13:23
    Peter Aderhold

    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...

Please Sign in or register to post replies

Write your reply to: