Manual:Hooks/BeforePageRedirect
BeforePageRedirect | |
---|---|
Available from version 1.19.0 Called prior to sending an HTTP redirect | |
Define function: | public static function onBeforePageRedirect( $out, &$redirect, &$code ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"BeforePageRedirect": "MediaWiki\\Extension\\MyExtension\\Hooks::onBeforePageRedirect"
}
}
|
Called from: | File(s): OutputPage.php |
Interface: | BeforePageRedirectHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:BeforePageRedirect extensions.
Gives a chance to override how the redirect is output by modifying, or by returning false and taking over the output.
$out
: OutputPage object&$redirect
: URL string, modifiable&$code
: HTTP code (eg '301' or '302'), modifiable