WordPress.org

Ready to get started?Download WordPress

Forums

[Request] A Plugin Which Will Suffix All the URL with something (3 posts)

  1. mukundis
    Member
    Posted 6 years ago #

    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

  2. mukundis
    Member
    Posted 6 years ago #

    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.

  3. mukundis
    Member
    Posted 6 years ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Topic