Block Comment Spam

real flame
No votes yet.
Please wait...

Automatically trash spam comments on WordPress with these simple steps. Spammers almost always insert hyperlinks in the comment form. By blocking just a few text strings, you’ll send their spam straight into the trash!

To automatically send all spam comments to trash, navigate to WordPress > Settings > Discussion. Once there, scroll to the bottom, find the ‘Comment Blacklist‘ section and enter: “www. http:// https://“, voilà! That’s it! By using this method, you won’t have to manually moderate spammer comments again.

wordpress blacklist comments
Relevant items highlighted.

The next thing you might want to do is inform users that submitting URLs is DISALLOWED. To do that, first, you’ll need to download the comment-form.php file.

You may add a text placeholder within the comment form field as a warning to ‘real’ users. To do this, open comment-form.php with any text editor such as notepad. Next, use the ‘find‘ function to search for [‘comment_field’]. You will see some code similar to this:

/* Set comment field */
		$args['comment_field'] = '<div class="form-item comment-form-comment"><label for="comment">' . __( 'Offer', 'webpoint' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> <textarea id="comment" name="comment" placeholder="Submitting URLs is DISALLOWED" cols="45" rows="8" maxlength="' . esc_attr( $comment_max_length ) . '" required="required"></textarea></div><!-- .comment-form-comment -->';

Once you find said section of code, simply splice in: placeholder=”Submitting URLs is DISALLOWED” as shown above.

Of course you can change “Submitting URLs is DISALLOWED” to anything you like. It’s just important to add it exactly as shown, likely after: textarea id=”comment” name=”comment”. Finally, save the file and see the result:


Lastly, you may get spammed by Russians that don’t use URLs. In case of this, simply start adding words they send you. Or you can preemptively paste-in a list common Russian words.

By following the guide above, any comment with a URL / hyperlink will automatically get added to the WordPress ‘comment trash’ — you’ll never have to moderate spam again!

Act Fast!

* - Required fields