How to Disable Auto Linking of URLs in WordPress Comments

Why WordPress Autolinks Text URLs in Comments?

WordPress automatically converts text URLs into links which makes it easier to visit the link while moderating comments.

This auto-linking is not stored in your database. WordPress makes URLs clickable when displaying them on screen in admin area as well as comments section below your articles.

Some of these comments are genuine where commenters didn’t know how to add a link in comments. But many spam comments also contain plain URLs pasted directly in the comment text.

Disabling Auto-Link in WordPress Comments

Simply add this single line of code in your theme’s functions.php file or in a site-specific plugin.

Tables can't be imported directly. Please insert an image of your table which can be found here.

1

WordPress does not store plain text URLs as links in the database. Instead it changes them into clickable links on the fly. This code simply disables the filter that makes URLs clickable.

This makes plain text URLs non-clickable in admin area and comments section below your posts. Removing this code will re-enable the auto linking.

If you are adding it to your theme’s functions.php file, then updating your theme will overwrite your functions file.

Also keep in mind that this code only works on plain text URLs. If a user decided to create a link by adding the proper HTML tag, then those links will appear as they should.

Was this article helpful?
0 out of 0 found this helpful