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": "MyExtensionHooks::onRandomPageQuery"

For MediaWiki ≤1.25:

$wgHooks['RandomPageQuery'][] = 'MyExtensionHooks::onRandomPageQuery';
Called from:File(s): specials/SpecialRandompage.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