It’s probably a 5 line plugin to do that.
Give me an example of what the destination URL looks like.
Untested. Actually the forum is deleting some of the code so use it from here:
http://pastebin.com/f54a958de
<?php
/*
Plugin Name: Wiki Link
*/
add_action('post_text','wiki_link',200);
function wiki_link($text) {
$url="http://example.com/path_to_wiki?terms=";
$text=preg_replace("/([[(.+?)]])/si","<a class='wiki_link' href='$url$2'>$2</a>",$text);
return $text;
}
?>
the above is missing two $2, should look like
<a class='wiki_link' href='$url$2'>$2</a>
The destination URL would be http://wiki.mydomain.com/wiki/PAGE And it cleverly sees the spaces (like ‘Main Page’) and turns that into underscores (Main_Page).
<?php
/*
Plugin Name: Wiki Link
*/
add_action('post_text','wiki_link',200);
function wiki_link($text) {
$url="http://example.com/path_to_wiki/";
$wiki= str_replace(" ", "_", "$ 2");
$text=preg_replace("/([[(.+?)]])/si","<a class='wiki_link' href='$url$wiki'>$ 2</a>",$text);
return $text;
}
?>
It does eat that $2 doesn’t it…
There’s no way your version works because the str_replace is executed immediately and the $2 isn’t available at that time. The regex would either have to use a callback or be expanded to catch words (or look on php.net for the /e modifer)