Jump to navigation Jump to search
Available from version 1.4.0
Occurs whenever the software receives a request to delete an article
Define function:
public static function onArticleDelete( WikiPage &$article, User &$user, &$reason, &$error ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"ArticleDelete": "MyExtensionHooks::onArticleDelete"

For MediaWiki ≤1.25:

$wgHooks['ArticleDelete'][] = 'MyExtensionHooks::onArticleDelete';
Called from:File(s): WikiPage.php

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


  • $article: the article that was deleted. WikiPage in MW >= 1.18, Article in 1.17.x and earlier.
  • $user: the user (object) deleting the article
  • $reason: the reason (string) the article is being deleted
  • $error: if the requested article deletion was prohibited, the (raw HTML) error message to display (added in 1.13)

See also[edit]