For those who have a blog running on Wordpress, like me.
Have you noticed that weird comments often come from strangers? It is innocent, it would seem. For example, “the author is well done, cool wrote,” “Your post is very interesting, and do you know that Pugovkin died today?”, Or something else like that.
In these comments the name of the sender is displayed as a link to a site. Thus, sending blogs of identical comments disguised as usual answers from your readers, spammers use you as an advertising platform for their site - the more links to it on the Internet, the higher its search engine rankings.
')
Since I was tired of deleting these comments, I decided to simply neutralize them - let them be shown, but I need to make sure that the commentator’s name is not a link.
In the directory where Wordpress is installed, find the file wp-includes / comment-template.php. It has a get_comment_author_link () function. In the region of the 111th line in the file will be the following code:
if (empty ($ url) || 'http: //' == $ url)
$ return = $ author;
else
$ return = "<a href='$url' rel='external nofollow'> $ author </a>";
If you are not familiar with programming, this code means: “if the author of the comment has not indicated the correct address of his site, then we will simply output his name, and if he did, then we will output the name as a link to his site”.
Leave out of these four lines only $ return = $ author;, and remove the other three. Save the file and upload it to the server.
In addition, if the URL field in the comment submission form is not used for you to log in via OpenID, as I have, you can delete or hide it altogether.
To do this, search the wp-content / themes / theme_name / comments.php file, or simply go to the “Design” section of the administration interface, click “edit theme”, and select comments.php on the right.
Closer to the end of the file will be the following code:
<p> <input type = "text" name = "url" id = "url" value = "<? php echo $ comment_author_url;?>" size = "22" tabindex = "3" />
<label for = "url"> <small> Website </ small> </ label> </ p>
Either delete this text completely, or comment out (I can’t show how to do this - the Habrahabr engine does not allow). Even more cunning - you can not delete anything, but simply replace type = "text" with type = "hidden". Then this input field will not be visible to the user, but when you receive a notification about a new comment by e-mail, you will see if the commentator indicated the address of his site or not. If you specify - 100% spammer, because an ordinary user cannot do this, because he simply does not see the input field.
And of course, in the blog settings (Wordpress Administration Interface → Settings → Discussion), select “Hold a comment if it contains 1 or more links”, if you have not already done so.
That's all. Probably, instead of all this, you can deliver captcha, but who likes to enter tsiferki every time?