Manual:Tags

Tag names
If you are planning to hard-code tags into your extension, pick a somewhat unique name to avoid conflicts. For example, VisualEditor uses,  , and. Tag names may not contain  (comma) or   (forward slash) characters.

If your extension allows users to enter their own tag names, you can use the  function to validate those names. (There is no need to pass the optional  parameter for this purpose.) This function will reject invalid tag names, as well as tag names that are already reserved by another extension or by users on the wiki.

Make sure to register all tags your extension uses (whether hard-coded or user-supplied) by implementing the hook. If a tag is in active use (that is, it is not disabled), you should also list it via the hook.

If you wish to prevent users from creating certain tags, you can implement the hook. For example, the OAuth extension uses this hook to reserve all tags beginning with  (see source).

Using tags from extensions
All tags used on at least one revision, and any tags listed by the hook, are shown on Special:Tags.

Each tag is known by a code name, which functions as its unique identifier. This code name is displayed on Special:Tags. Two messages are associated with each tag:
 * can be used to set the "display name" or "friendly name" of the tag. If set, this message will be used on history pages etc. instead of the tag's code name.
 * provides a description to be displayed on Special:Tags.

To add a tag to a revision, recent changes entry, or log entry, use. The hook can be useful for this purpose.

Extending Special:Tags
By default, tags defined by extensions cannot be manipulated from Special:Tags at all. All tag management tasks are left up to the extension.

If you wish, you can allow users to delete a tag defined by your extension from the regular Special:Tags interface. To do this, you must implement the hook to mark the tag as deleteable, then implement the  hook to perform extension-specific cleanup actions after MediaWiki has removed the tag from all revisions and log entries to which it is applied.