Make URLs within posts clickable
Automatically make unlinked URLs within wordpress posts clickable.
TweetDid you know that WordPress has a function ‘make_clickable’ which converts plain text URLs to HTML links? It converts URI, www, ftp, and email addresses to clickable hyperlinks and also helps by fixing links within links.
To make use of this function in the most effective manner, edit your theme’s functions.php file and add the following line:
1 | add_filter('the_content', 'make_clickable'); |
The above code will automatically make all links clickable in your post content. If you want the returned content to be used some place else,
1 2 3 | $theContent = make_clickable(get_the_content( ) ); // Then, echo it wherever you wish to display the content echo $theContent; |
Source: Codex
Was this post useful? Share on Twitter or Facebook and spread the love.
Related Posts
- Make URLs within posts clickable
- How to remove the WordPress Admin Bar
- Fix “Is its parent directory writable by the server?” error for WordPress Image uploads
Below is a list of possibly similar posts, as suggested by six huge golems hired to do just that.
Now What?
- Tweet this It's been long since you tweeted
- Ask Got a query you want us to answer?
- Spread the love Share it socially
Finished reading? Wondering what to do? Heres a hint. Here are some suggestions just for you