Auto-Link urls in WordPress Content

By Posted in - Blog Post & Wordpress plugin on April 24th, 2014 0 Comments

A while back, I wrote about this amazing WordPress function that auto-links content in custom fields.

Up until today, I never had a reason to use it on regular, old WordPress content (i.e. the_content).

It turns out that you need to filter the_content function rather than wrap it in the make_clickable() function like we did with custom fields.

So, the solution is to add the following to your theme’s functions.php file:

// Make hyperlinks clickable even if the user doesn't add the html markup
add_filter( 'the_content', 'make_clickable', 12 );

We use the priority of “12” so that it runs after shortcodes and other formatting stuff that naturally happens on the_content.

Pretty cool, eh?

Thanks to BetterWP.net for this solution.

Comments are closed.