X

Convert URI, WWW, FTP, and Emails into Clickable Links

Snippets by IsItWP

Are you looking for a way to convert URI, WWW, FTP, and email addresses into clickable links? While there’s probably a plugin for this, we have created a quick code snippet that you can use to convert URI, WWW, FTP, and email addresses into clickable links within within the_content and the_excerpt.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

add_filter('the_content', 'make_clickable');
add_filter('the_excerpt', 'make_clickable');

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 7 best WordPress poll plugins to grow onsite engagement and how to add a portfolio to your WordPress site.

Comments  Leave a Reply

  1. I need an external link to “Read more” (example) at the end of an excerpt that links to the external site where the article was posted. I used WP “Press This” to create the post but it links to the post under my site’s permalink. I have tried everything. Creating the post in “Press This” does include a via (and then article name linked to article URL) but it doesn’t show up anywhere else when posted on my home page as a post.

  2. P. Neamt Cultural August 5, 2011 at 11:28 am

    This doesn’t seem to work on my template. What could be wrong? I’ve only used the_excerpt snippet, do I have to use them both?
    Thanks!

    1. Try placing make_clickable(get_the_content) or the_excerpt within your template and see if that will work for you.

  3. Hey, this is a cracking bit of code, how could I add this to a custom metabox.

    1. Hey glad you like the snippet, what you could do is wrap the make_clickable() around your content in your template. Rather then above you could do make_clickable(get_the_content());  so you could do something like that.

  4. Deux fonctions de traitement de texte WordPress bien pratiques | Yann "Bug" Dubois June 16, 2011 at 6:53 am

    […] Appliquer la fonction “make_clickable” à tous les contenus pour rendre URL et adresses … addthis_url = 'http%3A%2F%2Fwww.yann.com%2Ffr%2Fdeux-fonctions-de-traitement-de-texte-wordpress-bien-pratiques-16%2F06%2F2011.html'; addthis_title = 'Deux+fonctions+de+traitement+de+texte+WordPress+bien+pratiques'; addthis_pub = ''; […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!