Available from version 1.21.0 (Gerrit change 42268)
Called when converting a Content object to a string to which filters can be applied.
Define function:
public static function onAbuseFilter_contentToString( Content $content, ?string &$text ) { ... }
Attach hook:
$wgHooks['AbuseFilter-contentToString'][] = 'MyExtensionHooks::onAbuseFilter_contentToString';
Called from:File(s): AbuseFilter / includes/AbuseFilter.php
Function(s): contentToString

For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:AbuseFilter-contentToString extensions.

If the hook function returns true, Content::getTextForSearchIndex() will be used for non-text content.


  • $content: The Content object
  • &$text: Set this to the desired text.