Manual:Hooks/InitializeArticleMaybeRedirect

From MediaWiki.org
Jump to: navigation, search
InitializeArticleMaybeRedirect
Available from version 1.13.0
Called when checking if title is a redirect.
Define function:
public static function onInitializeArticleMaybeRedirect( $title, $request, &$ignoreRedirect, &$target ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"InitializeArticleMaybeRedirect": [
			"MyExtensionHooks::onInitializeArticleMaybeRedirect"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['InitializeArticleMaybeRedirect'][] = 'MyExtensionHooks::onInitializeArticleMaybeRedirect';
Called from: File(s): MediaWiki.php

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

Details[edit]

  • $title: Title object ($wgTitleManual:$wgTitle)
  • $request: WebRequest
  • $ignoreRedirect: boolean to skip redirect check
  • $target: Title/string of redirect target