Jump to content


From mediawiki.org
Available from version 1.26.0
Modify the query used by Special:Random
Define function:
public static function onRandomPageQuery( &$tables, &$conds, &$joinConds ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"RandomPageQuery": "MediaWiki\\Extension\\MyExtension\\Hooks::onRandomPageQuery"
Called from: File(s): specials/SpecialRandompage.php
Interface: RandomPageQueryHook.php

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


Allows extensions to modify the query used by Special:Random.

  • &$tables: Database tables to be used in the query
  • &$conds: Conditions to be applied in the query
  • &$joinConds: Join conditions to be applied in the query