Hi All, I want to make a plugin which will prefix all the links in my blog with my redirect link.
Such as http:google.com is replaced by http://domain.com/redirect?=http://google.com
I wrote a plugin for 2.3 and above. But its not working with 2.5
Hi All, I want to make a plugin which will prefix all the links in my blog with my redirect link.
Such as http:google.com is replaced by http://domain.com/redirect?=http://google.com
I wrote a plugin for 2.3 and above. But its not working with 2.5
I have written following code
function wp_external_links($text) {
$pattern = '/<a (.*?)href="(.*?)\/\/(.*?)"(.*?)>(.*?)<\/a>/';
$text= preg_replace_callback($pattern,'parse_external_links',$text);
return $text;
}
It does nothing. Here I am trying to replace all the occurence of <a href= with a prefix.
it worked. Great. But not how I wanted. But still I can work on it now. Thanks for efforts.
If someone can develop this into a real plugin with some admin options please do. Its a nice idea. :)
This topic has been closed to new replies.