Auto convert WordPress post content URLs to Hyperlinks and open in a new window

I needed to have all of my post content plain text URLs converted to Hyperlinks, but it needs to open in a new window when clicked. The make_clickable() function in wordpress doesn’t allow to specify any option for the target. function make_clickable2($content) { $content = preg_replace("/http:\/\/[a-zA-Z.&\-\/]+[a-zA-Z&\-\/]+/", "<a href=\"\${0}\" target=\"_blank\">\${0}</a>", $content); return $content; } add_filter('the_content', 'make_clickable2');

Display Comments Statistics Adopted

Taking the spirit of open-source and to maintain something that I use in my blog / personal website, I’ve adopted Display Comments Statistics plugin for WordPress. Display Comments Statistics was originally created by Mário Gamito (R.I.P). I think he deserves someone to maintain it. ” This plugin shows the total number of articles and comments [...]



Who Am I ?

I'm Marco Rodrigues and I currently work in Luxembourg as System Administrator.

Contact me.








Subscribe to my feed

Search

    Writing

    26 articles
    1176 comments

      Comments

      platforms
      windows 1128
      linux 21
      macos 3
      sun 0
      wp 0

      browsers
      ie 1059 
      firefox 57 
      opera 55 
      safari 15 
      chrome 11 
      epiphany 1 
      bonecho 0 
      flock 0 
      konqueror 0 
      iceweasel 0 
      lynx 0 
      netnewswire 0