Manual:Hooks/TitleExists

From MediaWiki.org
Jump to navigation Jump to search
TitleExists
Available from version 1.24.0 (Gerrit change 160546)
Called when determining whether a page exists at a given title.
Define function:
public static function onTitleExists( Title $title, bool &$exists ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"TitleExists": "MyExtensionHooks::onTitleExists"
	}
}

For MediaWiki ≤1.25:

$wgHooks['TitleExists'][] = 'MyExtensionHooks::onTitleExists';
Called from:File(s): Title.php
Function(s): exists

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

Details[edit]

  • $title: The title being tested.
  • &$exists: A boolean; whether the title exists.