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); ?>
Gain access to all tutorials
- Premium tutorials covering WordPress, Laravel and VueJS
- Download premium content
- Download premium WordPress plugins
- Only $5 a month
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.