Recently, we received a request to help disable the automatic linking of URLs in comments in WordPress. In this article, we will show you how to disable URLs in WordPress comments.
Why does WordPress automatically link URLs in comments?
WordPress automatically converts URLs to links making it easier to access the link while reading the comments.
This automatic association is not stored in your database. WordPress makes URLs clickable when displayed on the screen in the admin area as well as in the comments section below your posts.
This feature is very convenient because readers can easily insert links into their comments. However, there are also a lot of spam URL links in the comments section.
How to disable the URLs in WordPress comments
The simple way is that you just need to add this line of code in the functions.php file of the theme you are using.
remove_filter( 'comment_text', 'make_clickable', 9);
WordPress does not store simple URLs as links in the database. Instead, it changes them to directly clickable links. This code simply disables the URL conversion tool.
This makes the URL links unclickable in the comments section. Deleting this code will re-enable automatic linking.
If you add it to your theme’s functions.php file, updating the new theme will overwrite the old function.php file.
You need to know this code only works on some simple URLs. If the user creates a link by adding the appropriate HTML tags, the links will appear normally.
Ok, it’s as simple as that. Good luck!