Is you blog receiving too much of spam? You can substantially reduce the flow of spam comments on your WordPress blog by removing the website URL field from your comment form and not allowing any links in comments.
Spam is one of the biggest problems on the Internet. As a website owner and blogger, you must have been inundated with spam comments and emails.
SEOs use automated tools that post random comments on your blog. Why? The backlink, though nofollowed, is valuable to link builders. With comment spam, you are fighting automated scripts and applications.
The solution: don’t give any links in comments.
How to Remove URL/Website Field from WordPress Comment Form?
You can easily customize your WordPress website and remove the website URL input field from the comment form. No URL field means no automated spam (or at least significant reduction).
There are multiple options to remove the website / URL input field from your WP comment form.
Option 1: Simply copy-paste the following function / code in your theme’s functions.php file.
/* Remove Comment Author URL from Form */
function wpflux_disable_comment_url($fields) {
unset($fields[‘url’]);
return $fields;
}
add_filter(‘comment_form_default_fields’, ‘wpflux_disable_comment_url’);
Option 2: Add the following code in your theme’s functions.php file to filter out the comment field.
/* Remove Comment Author URL from Form */
add_filter(‘comment_form_field_url’, ‘__return_false’);
Option 3: Install any good WordPress plugin to remove the URL field from your comment form.
How to Remove Comment Author Website Link in WordPress?
Though WordPress comments, including comment author website URL links, are made nofollow, it doesn’t act as a deterrent. Spam link builders abuse WordPress blogs to generate links.
You need to remove the backlinks or comment author website URL link altogether. Removing the comment author input field from the form is a great way to do this for all future comments.
What about the author links in existing comments?
Here’s the code that will remove comment author URL from appearing in the front. Simply copy-paste the following function / code in your theme’s functions.php file. All your comment author links will be gone.
/* Remove Comment Author URL from Comment Display in Front */
function wpflux_no_author_url( $url, $id, $comment ) {
return “”;
}
add_filter( ‘get_comment_author_url’, ‘wpflux_no_author_url’, 10, 3);
How to Remove Website Links in WordPress Comments?
Another issue with WordPress comments is the link within the comment text.
When someone adds a plain text URL in comment text, WordPress automatically makes it clickable. Disable auto-linking of text urls in WordPress comments.
How to disable auto-linking of URLs in WordPress comments?
/* Do Not Make Links Clickable in Comments */
remove_filter(‘comment_text’, ‘make_clickable’, 9);
Simply copy-paste the code above in your WordPress theme’s functions.php. It will prevent links from appearing in the comment body. The code above disables the filter that makes URLs clickable.
How to Disable & Strip HTML Tags from Comments in WordPress?
Spam comments often have a website link added via HTML tag within the text.
By default, WordPress allows certain HTML tags in comments such as <a> <strong> and <code> etc. Most SPAM comments made via bots and automated scripts contain these tags as the objective is to acquire a backlink. If you disable HTML from your WordPress comments, it turns away a lot of comment spammers.
How to disable HTML tags in your WordPress comments?
Let’s make use of a WordPress function for cleaning comment text and removing all HTML tags. It’s up to you whather you want to allow certain tags or remove all of them.
In the example below, all HTML tags except for bold text and italicized / emphasis text, are removed before posting the comment.
/* Stip HTML Tags from Comment Text */
function wpflux_remove_html($comment) {
return strip_tags($comment, ‘<strong><b><em>’);
}
add_filter(‘get_comment_text’, ‘wpflux_remove_html’);