Deleting unused tags

I found this closed post regarding unused tags and thought I might share this solution for anyone else who has too many unused tags to delete one at a time. (I had over 300.)

The SQL query below will return all of your database entries for tags that aren’t used on any records. From there you can delete them all at once.

SELECT
    id,
    name
FROM
    omeka_tags
WHERE
    id NOT IN(
    SELECT
        tag_id AS id
    FROM
        omeka_records_tags
)

Thanks, @ebellempire , for this.

I’m just worried such a solution would be useful only for users who know how to directly deal with the database, and it seems the majority of Omeka admins have got it installed by someone in the IT department or even by their domain hosting techs, so a more general solution might be needed to help them too. Maybe, if via a plugin we could add a “purge” button in the tags page to get rid of all “ghost” tags at once, that could be great; button would be disabled if there was not “ghost” tag, of course.

As said in the closed thread you were referencing to, I do believe the whole issue comes from a lack of checks in the original code (probably in the begininng it was not felt like that), so a change in the core as the ones suggested there could address the issue of “ghost” tags and also allow for an easy merging of tags; I hope such changes can be considered by Omeka developers, sooner or later. Actually, the whole tag page could also probably improved, making it easier to use for users who deal with many tags.

Yeah, this is definitely an intermediate-level tip, not a solution for novices or for the platform as a whole.

In addition to your suggestions, any redesign of the tag page should probably also include a link from each tag to its respective records. That’s a request I’ve gotten from site admins in the past.

When you select “Item” as Record Type in the tags page, every tag becomes a link to a items/browse page with that tag as common element. Would that help, or were you thinking of something more general?

Ah, I never noticed that.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.