Comment spam is one of the biggest challenges facing WordPress bloggers who accept blog comments. Many users comment just to leave their website link URL. This is an easy way to get backlinks from authoritative websites. If you only want to accept comments from interested users, you can delete the site URL or comment author link from the WordPress comment form.
Manage spam in WordPress comments
In our previous article, we have explained how to effectively block spam comments in WordPress. Basically, you can use the following options:
- Use plug-ins such as Akismet to filter spam comments automatically.
- Block comments in the IP address list.
- Prevent radical comments by blocking sensitive words.
- Limit the comments of registered users.
- Keep all comments for review and manual approval.
- Make comments appropriately, including a certain number of hyperlinks.
Although all of these methods reduce spam, you can’t get rid of spam completely for one reason. That is the URL text box for the website available in the WordPress comment form.
WordPress comment form behavior
By default, the WordPress comment form has the following fields:
Default WordPress comment form
- Comment message box
- Name
- website
- Save the name / email / website in the browser for further comments
- Submit button
You can enable or disable saving names / emails / Web sites in the browser options under the Settings & gt; discussion section.
Disable the save name and email option
Apart from this option, there are no settings available in the WordPress administration panel to change the comment form field.
Website URL in the comment form
Almost 75% of users leave comments just to provide their site URL and get a backlink. By default, WordPress willrel="external nofollow ugc"
Parameters are assigned to comment links to indicate what is generated for the user. However, these links can still damage your site, especially if they have nothing to do with your site, such as pornographic links. After a user posts a comment on your site, WordPress will display the approved comment through the link name and URL field.
A website linked to the name of the author of the comment
Six methods of deleting website URL in WordPress comments
If you receive hundreds of thousands of spam comments, the best option is to disable the site URL field in the comment form. If there is no URL option in the form, spammers targeting backlinks will stop. In addition, you can save the server bandwidth required to process comment submissions. You can delete comment author links in WordPress in a number of ways.
1. Use CSS to disable the website URL in the WordPress comment form
When you look at the source code of the comment form, you can easily see that WordPress uses the comment-form-url class to display the website URL in the form. All you need to do is simply go to the “look & gt; attach CSS” section, paste the following CSS code, and publish your website.
.comment-form-url{ display:none; }
This removes the comment author link box from the WordPress comment form. Here’s what it looks like on the developer console of the 2021 theme browser.
Use CSS to disable the website URL in comments
two。 Use the feature to disable website URL and comment author links
The above option is easy to do, although it may not apply to all WordPress themes. Because a topic can use a custom CSS to modify the default WordPress comment form, you must check the topic’s CSS before using the above method. In addition, all your old comments will still have a website linked to the author’s name, URL. Therefore, the next option to remove the author link from the comment is to use a function in the topic’s functions.php file.
You can go to the “appearance & gt; theme Editor” section and find the “functions.php” file for your active theme. Paste the following code to the end of the file, and then click the 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 this in your file:
Add a function to delete a link to a comment author
If you use the caching plug-in, be sure to clear the cache and check your comment form. Don’t be surprised that the site URL field still exists on the comment form. The purpose of this code is to remove the hyperlink between the comment author’s name and the website URL on the published comment. Therefore, you no longer need to worry about the site URL field in the comment form. When you approve a comment, it will not be used at all. This function also removes the comment author link from all existing comments that have been posted on your site.
Comment author link deleted
Keep in mind that editing the theme’s functions.php is not recommended because the changes will be cleared when you update the theme. You can use subtopics for this purpose or use the code snippet plug-in to add the above code as a separate snippet.
3. Use the function to delete the website URL from the WordPress comment form
Instead of the above function, you can insert the following code into the functions.php of the theme. This feature will completely delete the website URL submitted in the WordPress comment 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; }
In your comment form, it will look like this.
The website URL in the comment form has been deleted
4. Use the free plug-in to delete the comment author link
This is a super simple and free method. Go to the “plug-ins & gt; installation plug-ins” section of the WordPress administration panel and install the “Hide Comment Author Link” plug-in.
Install the Hide Comment Author Link plug-in
The plugin does not have any settings page, and when activated, the comment author link in the posted comments will be disabled. Keep in mind that this plug-in works the same as the add function explained in method 3 above. As a result, you will still see the URL link to the site, and users can leave their site’s URL in the comments. However, the name of the author of the comment in the published comment will not provide URL.
5. Disable the comment URL using the advanced plug-in
The next option is to use the advanced performance optimization plug-in for this purpose. Instead of using a dedicated plug-in for this purpose, you can use the ultimate performance optimization plug-in. The single-site license fee for this plug-in is $24.95 to help you disable unnecessary items from your WordPress installation. You can disable WooCommerce styles / JS, feeds, XML-RPC, and many other items with just a few clicks.
In addition, the above two methods (adding features and free plug-ins) are not desirable because they confuse the reviewer with the site URL that is available on the form but deleted from the published comments. Therefore, we recommend using the Perfmatters advanced plug-in for this purpose.
- After activating the plug-in, go to the Settings & gt; performance menu.
- Navigate to the options & gt; General section.
- Scroll down and enable the Delete comment URL option.
- Click the Save changes button to apply the changes on your site.
Delete a comment URL using Perfmatters
This plug-in removes the site URL field from your comment form and removes the comment author link from all existing comments.
6. Disable site URL from theme settings
Some topics allow you to disable comments submitted in the WordPress comment form and the website URL. For example, you can easily do this using the popular Kadence theme by clicking on the customizer settings. Before you try any of the above options, check to see if your theme provides such functionality.
Delete the comment site field in the Kadence topic
Summary
Comment site URL is the largest source of spam on WordPress sites. However, you do not have any default options to disable the comment author link or delete the site URL from the WordPress comment form. You can use any of the above methods that work well on your website. After testing all of these methods, we recommend using Perfmatters because it can improve the performance of your site through many other optimizations. Although deleting ReURL can reduce manual spam, you may still receive comments from automated robots. In this case, use a security plug-in to block robot access or add CAPTCHA protection to the comment form.