Jump to: navigation, search

Revision tags or change tags are annotations associated with a revision or log entry. They are displayed in various locations when referring to revisions, such as in the page history, diffs, recent changes and other places.

A complete list of all the available tags is displayed on Special:Tags. Users with the managechangetags user right – administrators by default – can use this special page to create and delete tags (see Help:Tag management).

Extensions (for example AbuseFilter and VisualEditor) mark edits made through their interface with tags.

Tag names[edit | edit source]

If you are planning to hard-code tags into your extension, pick a somewhat unique name to avoid conflicts. For example, VisualEditor uses visualeditor, visualeditor-check, and visualeditor-switched. 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 ChangeTags::canCreateTag( $tag ) function to validate those names. (There is no need to pass the optional $user 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 ListDefinedTags hook.

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

Using tags from extensions[edit | edit source]

All tags used on at least one revision, and any tags listed by the ListDefinedTags 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:

  • MediaWiki:tag-$name 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.
  • MediaWiki:tag-$name-description provides a description to be displayed on Special:Tags.

To add a tag to a revision, recent changes entry, or log entry, use ChangeTags::addTag(). The RecentChange_save hook can be useful for this purpose.

See also[edit | edit source]