Comment spam is one of the biggest challenges for WordPress bloggers those accept comments on their blogs. Many users leave comments only with an intention to leave their website link URL. This is an easy way to get a backlink from authoritative websites. If you only want to accept comments from interested users, then you can remove the website URL or comment author link in WordPress comments form.
Managing Spam in WordPress Comments
In our earlier article, we have explained how to effectively prevent comment spam in WordPress. Basically, you can use the following options:
- Use plugins like Akismet to automatically filter spam comments.
- Block comments from list of IP addresses.
- Prevent aggressive comments by blocking with unwanted words.
- Restrict comments for registered users.
- Hold all comments for moderations and manual approval.
- Hold the comment in moderation it contains certain number of hyperlinks.
Though all these methods will reduce the spam, you can’t completely get rid due to one reason. That is the website URL text box available in WordPress comment form.
WordPress Comment Form Behavior
By default, WordPress comment form has the following fields:
- Comment message box
- Name
- Website
- Save name/email/website in browser for further commenting
- Submit button
You can enable or disable the saving name/email/website in the browser option under “Setting > Discussion” section.
Other than this option, there are no settings available in WordPress admin panel to change the comment form fields.
Website URL in Comment Form
Almost, 75% of the users leave comments to simply provide their website URL and get backlink. WordPress by default assigns “rel=”external nofollow ugc” parameter to comment links indicating them as user generated content. However, these links can still harm your site especially when they are irrelevant to your site like pornography links. After a user left comment in your site, WordPress will show the approved comment by linking the name and URL fields.
6 Ways to Remove Website URL in WordPress Comments
If you receive hundreds of thousands of spam comments, the best option is to disable the website URL field in the comment form. Spammers targeting to get backlink will stop if there is no URL option in the form. In addition, you can save server’s bandwidth needed for processing comment submission. You can remove comment author link in WordPress using multiple ways.
1. Disable Website URL in WordPress Comments Form with CSS
When you look at the source code of comment form, you can easily find that WordPress uses comment-form-url class to show the website URL in the form. What you need to do is to simply, go to “Appearance > Additional CSS” section paste the following CSS code and publish your site.
.comment-form-url{
display:none;
}
This will remove the comment author link box from WordPress comments form. Below is how it will look on twenty-twenty one theme browser’s developer console.
2. Disable Website URL and Comment Author Link with a Function
The above option is easy to do though it may not work on all WordPress themes. Since, themes can use custom CSS to modify default WordPress comment form, you have to check your theme’s CSS before you use the above method. In addition, all your old comments will still have website URLs linked with author names. So, next option to remove author link from comments is to use a function in your theme’s functions.php file.
You can go to “Appearance > Theme Editor” section and find “functions.php” file for your active theme. Paste the below code at the end of the file and click “Update File” button.
/* Remove Comment Author Link */
add_filter( 'get_comment_author_link', 'remove_comment_author_link', 10, 3 );
function remove_comment_author_link( $return, $author, $comment_ID ) {
return $author;
}
It should look like below in your file:
If you are using caching plugin, make sure to clear the cache and check your comment form. Do not get surprised that the website URL field is still there on the comment form. What the code does is to remove the hyperlink between comment author name and website URL on the published comment. Therefore, you need not to worry about the website URL field anymore in the comments form. It will be simply not used when you approve the comment. This function will also remove comment author links from all existing comments already published on your site.
Remember, editing theme’s functions.php is not recommended as the changes will be wiped off when you update your theme. You can use child theme for this purpose or use Code Snippets plugin to add the above code as an independent snippet.
3. Remove Website URL in WordPress Comments Form with Function
Instead of the above function, you can insert the below code in your theme’s functions.php. This function will completely remove the website URL filed in WordPress comments form. However, all existing links will be retained without any impact.
/* Remove Website URL in Comments */
add_filter('comment_form', 'remove_url_field');
function remove_url_field($fields){
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
It will look something like below in your comments form.
4. Remove Comment Author Link Using Free Plugin
This is a super easy way and free. Go to “Plugins > Add New” section in your WordPress admin panel and install “Hide Comment Author Link” plugin.
The plugin does not have any settings page and after activating it will disable the comment author link in published comments. Remember, this plugin does the same work as adding function explained in method 3 above. Therefore, you will still see the website URL link and user can leave their site’s URL in the comments. However, URLs will not be available with the comment author name in published comments.
5. Using Premium Plugin to Disable Comment URL
The next option is to use a premium performance optimization plugin for this purpose. Instead of using a dedicated plugin for this, you can use an ultimate Perfmatters optimization plugin. This plugin will cost $24.95 for single site license and help you to disable unnecessary items from your WordPress installation. You can disable WooCommerce styles/JS, feeds, XML-RPC and many other items with few clicks.
In addition, the above two methods (adding function and a free plugin) are not desirable since they can confuse the commenters with website URL available on the form but removed in the published comments. Therefore, we recommend using Perfmatters premium plugin for this purpose.
- After activating the plugin, go to “Settings > Perfmatters” menu.
- Navigate to “Options > General” section.
- Scroll down and enable the option “Remove Comments URLs”.
- Click “Save Changes” button to apply the changes on your site.
This plugin will remove the website URL field from your comments form and remove comment author links from all existing comments.
6. Disable Website URL from Theme Settings
There are themes that allow you to disable comments and website URL filed in WordPress comments form. For example, you can easily do this with the popular Kadence theme with single click from the customizer settings. Check your theme offers such a function before trying any of the above explained options.
Final Words
Website URL in comments form is the single largest source of spam in WordPress sites. However, you do not have any default option to disable comment author linking or remove website URL in WordPress comments form. You can use any of the above explained method that works well on your site. After testing all those methods, we recommend using Perfmatters as it can boost your site’s performance with many other optimizations. Though removing ReURL can reduce manual spam, you may still receive comments from automated bots. In such a case, use a security plugin to block bots access or add captcha protection in comments form.
Leave a Reply
Your email is safe with us.