Open main menu


< Manual:Hooks
Available from version 1.25.0 (Gerrit change 161471)
Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content.
Define function:
public static function onContentAlterParserOutput( $content, $title, &$output ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"ContentAlterParserOutput": "MyExtensionHooks::onContentAlterParserOutput"

For MediaWiki ≤1.25:

$wgHooks['ContentAlterParserOutput'][] = 'MyExtensionHooks::onContentAlterParserOutput';
Called from:File(s): AbstractContent.php

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


Modifies the parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called (such as adding tracking categories based on the rendered HTML).

The Content to render
Title of the page, as context
ParserOutput to manipulate