Available from version 1.7.0
permits filtering of the list of special pages enabled for the system
Define function:
public static function onSpecialPage_initList( array &$specialPages ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"SpecialPage_initList": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialPageinitList"
Called from: File(s): SpecialPageFactory.php
Function(s): getPageList()
Interface: SpecialPage_initListHook.php

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

Use cases


MediaWiki installations use the SpecialPage_initList hook when they want to add to or remove pages from the special page list. They can use this to:

  • dynamically add special pages from a database or other resource
  • remove undesirable built-in special pages from the default list
  • enable context dependent list of special pages - e.g. lists that depend on current server load, user's access method (local host, VPN, public internet)
  • replace the default class associated with a special page with a custom subclass
  • limit access to special pages based on user identity even in cases where the special page is not permissions aware



A special page is a "virtual" MediaWiki article. Instead of being loaded from a file or database like a normal MediaWiki page, its content is generated on the fly using PHP code.

By default, MediaWiki builds the list of special pages from two sources: a list of built-in special pages hardcoded into the MediaWiki core and the configuration variable $wgSpecialPages. As a final step, MediaWiki passes the default list to all the functions attached to the SpecialPage_initList.



Functions attached to this hook add and remove elements from $aSpecialPages. This array has the same structure as $wgSpecialPages.

The hook function should return true so as not to interfere with other functions that might be attached to this hook.