Advertisements
Advertisements
TechnologyWebsite BuildersWordPress Hosting

How to Remove Website URL Field from the WordPress Comment Form

Over the course of my two years engaged on the WP Mayor weblog, I’ve observed that many commenters used the feedback part to safe backlinks to their web sites. We’ve been utilizing spam detection plugins, however some human feedback at all times sneak by. Ever since I’ve been mulling over methods to fight remark spam.

In a current group assembly, Prithu, our new Editorial Supervisor, introduced one thing to my consideration:

WordPress robotically asks for commenters’ web site URL in all submissions.

It was a lightbulb second! We instantly realized that there was a quite simple answer to disable the remark URL for all feedback.

Advertisements

On this article, I’ll speak you thru why individuals submit spam feedback. Subsequent, I’ll information you thru the quite simple technique of removing the website URL field from the WordPress comment form.

Nicely, individuals submit spam feedback to try to enhance their search engine optimization. They do that by including their web site URL. On this approach, they’ll get a backlink from your web site. They consider that the extra backlinks from respected websites they get, the higher their search engine optimization rating.

This can be a blackhat search engine optimization trick and for the most half, it doesn’t work. Nevertheless, each weblog proprietor will let you know that they obtain tens of spam feedback each day nonetheless.

WordPress’s default remark kind consists of the following 4 fields: title, e-mail, web site URL, and the remark field.

Advertisements

To assist forestall remark spam, we’ll be eradicating the web site URL discipline listed above.

Deafult comment formThe default WordPress remark kind

On this answer, we’ll be utilizing the following code snippet.

add_filter(‘comment_form_default_fields’, ‘unset_url_field’);
perform unset_url_field($fields){
if(isset($fields[‘url’]))
unset($fields[‘url’]);
return $fields;
}

Advertisements

You possibly can manually place this in your theme’s functions.php file or use a snippets plugin to be safer. Remember the fact that in case you don’t know what you’re doing, you possibly can simply change one thing in the features.php file and hurt your web site.

On this case, I’ve used the Code Snippets plugin. Merely set up and activate the plugin in your web site, and add a brand new snippet.

Code Snippets

Kind in a title and add the code. Activate the snippet and also you’re good to go!

Add new snippet

To take a look at the last outcome, view the web site in incognito mode in your net browser.

Remove website URL from comment formThe ultimate outcome.

Spam feedback are an enormous drawback for all blogs. On this article, we’ve seen how to take away the web site URL discipline from your WordPress remark types utilizing PHP code.

We hope this technique has helped you fight remark spam and whereas we have now you right here, we advocate a couple of different ways in which could assist. You possibly can add reCAPTCHA, limit remark submissions, and extra.

Should you’ve used this answer or come throughout one other technique, tell us in the remark part beneath. However hey – no spam feedback! 😉

Show More
Advertisements

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *