Available from version 1.25.0
Tell whether a change tag should be able to be created by users.
Define function:
public static function onChangeTagCanCreate( $tag, $user, Status &$status ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"ChangeTagCanCreate": "MediaWiki\\Extension\\MyExtension\\Hooks::onChangeTagCanCreate"
Called from: File(s): ChangeTags.php
Interface: ChangeTagCanCreateHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ChangeTagCanCreate extensions.

Details edit

  • $tag: Name of the tag.
  • $user: User object representing the user who initiated the action. May be null.
  • &$status: Status object. Add your errors using $status->fatal() or warnings using $status->warning(). Errors and warnings will be relayed to the user. If you set an error, the user will be unable to create the tag.

Notes edit

This hook allows extensions to determine whether a change tag should be able to be created from the UI (Special:Tags) or via the API.

By default, users may create any tag, except if it contains invalid characters, it matches an existing tag name, or if the operation is prevented by this hook.

You could use this hook if you want to reserve a specific "namespace" of tags, or something similar. For example, the OAuth extension uses this hook to reserve all tags beginning with OAuth CID: (see source).

See also edit