Open main menu

Manual:Hooks/ArticleAfterFetchContentObject

ArticleAfterFetchContentObject
Available from version 1.21.0
After fetching content of an article from the database.
Define function:
public static function onArticleAfterFetchContentObject( &$article, Content &$content = null ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ArticleAfterFetchContentObject": "MyExtensionHooks::onArticleAfterFetchContentObject"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ArticleAfterFetchContentObject'][] = 'MyExtensionHooks::onArticleAfterFetchContentObject';
Called from:File(s): page/Article.php

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

DetailsEdit

  • $article: the article (object) being loaded from the database
  • &$content: the content of the article, as a Content object. Null if the user does not have access to the provided content.

NotesEdit

  • Not called when loading page from cache, use ?action=purge to force page render.
  • Also called when fetching article source for action=edit.