Convert URLs, emails and ftp addresses into clickable links

By default, WordPress will allow you to show links only if you create ones by yourself. That means that you can create a link by selecting a word or the entire phrase, clicking on the “link” button and providing the URL if you’re working in the Visual Editor or you can write your own HTML code if you’re working in Text editor.

While this makes sense and makes creating links an easy task, if you write down the entire URL or an email address, WordPress would still recognize it as plain text.

If you tend to write full URLs, email addresses or FTP addresses on a daily basis, you are only going to lose time if you’re about to create those links manually. Instead, you can easily add filters which WordPress already recognizes as its own and thus tell your trustworthy web system to convert all that text into links automatically.

If you have decided to do so, here is how you can have your automatic links:

  1. Open functions.php file
  2. Copy and paste these filters:
  3. add_filter('the_content', 'make_clickable');
    add_filter('the_excerpt', 'make_clickable');
  4. Save changes

As you can see from the code itself, the same “make_clickable” filter is applied both to the content and the excerpt. You can, of course, choose where you want the automatic link conversion so feel free to choose only one of those if you want so.

If you are developing your own theme or customizing the existing one, you can avoid the option of adding the filter to the entire content or the excerpt and use the filter only in specific situations. In that case, you can use the filter in templates files:

<?php make_clickable( $text ) ?>

Here’s the example of using the function:

$clickable = "This text contains a link to our website which will be automatically converted into a clickable link.";
echo make_clickable( $clickable );

There you go. With the power of “make_clickable” function, you can easily convert links anywhere in your WordPress theme. While there are times and places where you don’t want your addresses automatically being clickable, sometimes this will save you precious time you would end up losing by manually going through all the text and linking it.

We hope this article will help you in developing your WP website. Don’t forget to check out the rest of our tutorials in order to improve your WordPress experience.

Start Blog Book


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

One thought on “Convert URLs, emails and ftp addresses into clickable links

  1. My coder is trying to persuade me to move to .net from PHP.

    I have always dislikedd the idea because off the costs.
    Buut he’s tryiong none the less. I’ve been using Movable-type
    oon a variety of websites for about a year and am worried abgout switching
    to another platform. I have heard excellent things about
    Is there a way I can implort alll myy wordpress osts into it?
    Any help would be greatly appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *