Available from version 1.4.0
Occurs whenever the software receives a request to protect an article
Define function:
public static function onArticleProtect( &$wikiPage, &$user, $protect, $reason, $moveonly ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"ArticleProtect": "MyExtensionHooks::onArticleProtect"
Called from:File(s): page/WikiPage.php

For more information about attaching hooks, see $1.
For examples of extensions using this hook, see Category:ArticleProtect extensions.


  • $wikiPage: (object) the wikipage being protected
  • $user: (object) the user doing the protection
  • $protect*: boolean flag indicating whether the request is protect or unprotect
  • $reason: (string) Reason for protect
  • $moveonly: (boolean) flag indicating whether this is for move only or not

See alsoEdit