Magazine Tecnologia

How To Stop Spam Comments In WordPress

Creato il 17 febbraio 2016 da Dher
How To Stop Spam Comments In WordPress

If you own a WordPress blog then I am sure that you are facing this problem too and that is "Spam Comments". There are many spammers who tries to mark your blog as a spam and I am facing this problem too, I am receiving daily many spam comments and now I came up with a solution and I am going to share that with you guys. So in this article I am going to tell you "How You Can Prevent Spam Comments On Your WordPress Blog".

But I cannot guarantee that the methods which I will tell you completely ban spamming on your blog but atleast you can prevent 60% of spam comments. Follow the below methods to prevent spam comments on wordpress.

1. Hold Comments For Moderation

I have seen many blogs where you comment and your comment directly posted/published there but if you have commented on my blog then you have seen a message " Your comment is under moderation. Come back soon" so by this when I login my dashboard and move to comments section there I see the Comments which are under moderation, so the Comments will be published on my blog if and only if I (admin) approve them. So by using this method you can prevent spam commenting and also you can prevent those commentors who promote their stuff in your comments.

2. Using .htaccess

We all know the importance of .htaccess file and here it can help you in securing your blog. Few lines of code can prevent your blog from spammers. Add the below code to avoid WordPress spam comments.

#Protect from spam bots

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php
RewriteCond %{HTTP_REFERER} !.yourwebsite.com. [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Replace "yourwebsite.com" with your blog url. The code only blocks SPAM BOTS and not humans who manually try to spam. Bots are the most annoying pests so preventing them from spamming is a good first step. As for human spam, we have another solution called Akismet

3. Using Akismet Plugin

There are thousands of Anti-Spam plugins but I will recommend you to use Akismet (I am also using this). Akismet is a free plugin for individuals, to setup Akismet you need API Key you can easily get that and for business use they have to pay little monthly charges.

How To Stop Spam Comments In WordPress

4. Block IP Address of Spammers

You can easily see IP Address of a person who comments on your blog then you can block their IP Address too. But I will recommend you to block the IP if you are getting more than 10 spam comments from same IP Address.

For blocking a IP Address you can use .htaccess, simply you have to add few lines of code there.

# block ip
order allow,deny
deny from 123.456.78.90
deny from 987.654.32.10
allow from all

In the above code, please change the IP Address I am using random numbers there.

Share your experience and how you prevent spam comments on your wordpress blog and If you have any query then please comment below, I will try to get back to you as soon as possible. Don't forget to share.


Potrebbero interessarti anche :

Ritornare alla prima pagina di Logo Paperblog

Possono interessarti anche questi articoli :