From mediawiki.org
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: stable
Implementation Parser extension
Description Provides dynamic linking of inline keywords, such as magic links.
Author(s) Nuno Tavares, wsd? (Nuno Tavarestalk)
Latest version 1.0
MediaWiki 1.25+ ?
Database changes No
License GNU General Public License 2.0 or later
  • $wgMagicalInit
  • $wgMagicalClassic
  • $wgMagicalLinkers
  • $wgMagicalPattern

Check usage and version matrix.

The MagicalLinkers extension provides dynamic linking of inline keywords, such as magic links. Following the discussion around the the future of magic links (more specifically, its removal from mediawiki core), 'wsd' (untraced) submitted a patch[1] to demonstrate how magiclinks could be turned into an extension. In the meantime, $wgEnableMagicLinks was introduced to aid in phasing these out, but the possibility of extending the list was not there.

This extension is nothing but the extension.json wrapping of the simple submitted patch.


  • Download and place the file(s) in a directory called MagicalLinkers in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'MagicalLinkers' );
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.27 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.27 and earlier), instead of wfLoadExtension( 'MagicalLinkers' );, you need to use:

require_once "$IP/extensions/MagicalLinkers/MagicalLinkers.php";


Besides normal extension insertion, you'll probably want to extend it with your own keywords. Example:

wfLoadExtension( 'MagicalLinkers' );
class MagicalLinkersExt {
	public static function linkBug( $text ) {
        $urlNumber = ltrim( substr( $text, 4 ), '0');
		$url = 'https://mybugplatform.mysite.pt/issues/?id=' . $urlNumber;
		$safeUrl = $url;
		return '<a href=\'' . $safeUrl . '\' class=\'mw-magiclink-bug\'>bug ' . $urlNumber . '</a>';
$wgMagicalLinkers = array(
		'linker' => 'MagicalLinkersExt::linkBug',
		'pattern' => 'bug:\\s*[0-9]+'

Tested on[edit]

  • MediaWiki 1.31