Paulund
2012-07-13 #wordpress

Make Content Clickable In Wordpress

Wordpress has a great feature I've just discovered which allows you to convert plain text into links for URLs or email addresses. If your content has URLs in the content but you haven't add the link you can use this Wordpress function to convert all plain text URLs to be links. The Wordpress function you need to use is called make_clickable(). This accepts one parameter which should be a string of the text you want to convert. It will be able to convert a number of different types of links:

  • URLs - Adds link to the URL
  • www - Adds link to the www link
  • FTP - Adds link to the ftp link
  • Email - Adds a link with a mailto around the email address

<?php 
$string = "This is a long text that contains some links like http://www.wordpress.org and http://www.wordpress.com .";
echo make_clickable($string); 
?>