Manual:Hooks/TitleMoveStarting

From MediaWiki.org
Jump to navigation Jump to search
TitleMoveStarting
Available from version 1.27.0
Before moving an article (title), but just after the atomic DB section starts.
Define function:
public static function onTitleMoveStarting( Title &$title, Title &$newtitle, User &$user ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"TitleMoveStarting": "MyExtensionHooks::onTitleMoveStarting"
	}
}

For MediaWiki ≤1.25:

$wgHooks['TitleMoveStarting'][] = 'MyExtensionHooks::onTitleMoveStarting';
Called from:File(s): Title.php
Function(s): Title::moveTo()

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

This hook is in Title::moveTo(), which is called from SpecialMovepage.php and ApiMove.php .

Details[edit]

  • $title: old Title
  • $newtitle: new Title
  • $user: User who is doing the move

See also[edit]