Disable Auto Links of URLs In WordPress Comments
You can notice that whenever a user write a comment in WordPress comment section in plain text and then publish it, the links inside comment will be clickable even though it was written in plain text. Many WordPress site owners does not like it.
WordPress automatically convert the URLs into clickable links to make it easier for the users to visit the link and also in the time of moderating comments.
The below image is showing comments from admin dashboard panel:
WordPress store any URL as plain text in database for comments. It doesn’t contain clickable link. It makes a URL clickable during processing through a filter. So you need to disable the filter that is responsible for making URLs in WordPress comments clickable.
- rel=”nofollow” for all external links in WordPress using code
- How To Detect Mobile Device From WordPress Theme
Simple code to disable Auto Linking in WordPress comments
Well, their is an easy way to disable this auto linking feature and the links in comments will no longer be clickable. You just need to put a line of code inside your theme’s functions.php and you will get rid of auto linking.
Here is the code:
// Remove auto linking from comment remove_filter ( 'comment_text', 'make_clickable', 9) ;
The above code will simply disables the filter that makes URLs clickable and you can see the URL in comment is not clickable now. The code makes the URL in plain text non-clickable both in comment section below posts and in admin panel.
Was that not so easy? Also it is really amazing that only one line of code solve this auto link system of WordPress which is disliked by a lots of WordPress users. Many bloggers who are running blog on WordPress has complained that often visitors want to take advantage and often spam comment detected. And also it is said by some SEO experts that low quality URL links can harm a site SEO in a little bit even though the link in comments has nofollow tag. So it is really a great solution.