• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 When are unused tags deleted?

jeffwidman

Active member
#1
I thought tags were auto-removed when no longer used, but I've got some tags that have usage '0'. Are they cleaned up by a cron job or should they be automatically removed as soon as they're no longer used?

Would an addon like MediaGallery or Vaultwiki potentially interfere with this? Both integrate with the XF tags system.

Will tags with usage '0' still get listed in the Sitemap?

Mostly they're tags that were used by spammers, so some of the terms are quite spammy--definitely not something I want to be telling Google to come checkout.
 

Brogan

XenForo moderator
Staff member
#2
Normally tags will be removed when they are no longer used (specifically, when their last usage is removed). Choosing to make a tag permanent prevents this. This is mostly significant for communities where admins will create a list of valid tags and not allow users to add their own.
Are you sure the tags are not being used on any threads, even soft deleted ones?
 

jeffwidman

Active member
#3
I'm not...

Would soft-deleted cause the ACP to report tag usage at 0 but still prevent them from being deleted?

Regardless, would also like to know if they're deleted immediately or by cron once they are truly unused.
 

Chris D

XenForo developer
Staff member
#4
Will tags with usage '0' still get listed in the Sitemap?
No, they are explicitly excluded from the Sitemap.

Regardless, would also like to know if they're deleted immediately or by cron once they are truly unused.
The use_count reflects the number of times the tag is used in content which is visible.

If you soft delete a thread, it will decrease the use_count, but the tag itself will not be removed from the xf_tag_content table, it will just have the visible field set to 0 (on the basis that soft deletion could be temporary, or accidental).

If you hard delete a thread, it will decrease the use_count but it will also remove the entry in the xf_tag_content table. Ultimately, when the usage is calculated, if a tag has no records in the xf_tag_content table then the tag will be deleted completely (immediately).

So, in summary, if the tag still exists, and it has a use_count of 0, it should be attached to content that is no longer visible and this tag will be excluded from the sitemap.