Artık WordPress’te Spam Yorumları Unutun 😎

İndir: Spam Yorum Eklentisini Unutun

Bu, WordPress’in varsayılan yorum sistemi için özel olarak geliştirilmiş ücretsiz bir anti-spam eklentisidir.

Nasıl çalışır

Alternatif olarak, ileri düzey kullanıcılar için manuel yöntem aşağıda verilmiştir

WordPress’in varsayılan yorum sisteminin iki büyük sorunu vardır.

  1. Çekici spam comments.
  2. Not sending follow-up email to the comment author (Will discuss in a while).

Onun hakkında konuşalım çözümler.

Spam Yorumları Önleme

Herhangi bir kişinin doğrudan izin vermesi yerine POST request at /wp-comments-post.php spam yorumları %100 oranında önlemek için bazı mantıklar ekleyebiliriz.

Adım 1. Restrict Comment POST request Path over Query Parameter

Üç yol paylaşacağım, bir yöntem kullanın.

Apache

  • Yoast > Go to Tools > File Editor
  • RankMath > Go to General Settings > Edit .htaccess
  • FTP/SSH > Check /var/www/html
# If Query string doesn't matches return 404
<IfModule mod_rewrite.c>
	RewriteEngine On
        RewriteCond %{REQUEST_URI} .wp-comments-post\.php
        # You may change 45jpfAY9RcNeFP to something else
        RewriteCond %{QUERY_STRING} !^45jpfAY9RcNeFP
	RewriteRule (.*) - [R=404,L]
</IfModule>

LiteSpeed kullanıyorsanız, .htaccess dosyasını da destekler. Uygulamadan sonra yeniden başlatmalısınız.

NGINX

location = /wp-comments-post.php {

 if ($query_string !~ "45jpfAY9RcNeFP") {
     return 404;
  }
}

Cloudflare

prevent spam comments
  • Giriş to Cloudflare Dashboard
  • Gitmek Firewall > Firewall Rules
  • Yeni bir firewall rule with below expression
FieldOperatorValue
URIcontainswp-comments-post.phpAnd
URL Query Stringdoes not equal45jpfAY9RcNeFP
  • Choose Action: Block

Sonunda, ifadeyi göreceksiniz

(http.request.uri contains "wp-comments-post.php" and http.request.uri.query ne "45jpfAY9RcNeFP")

Adım 2. Correct the Comment POST URL on Scroll event

  • Code Snippets eklentisini veya tema functions.php dosyasını kullanarak aşağıdaki işlevi ekleyin
  • Doğru alan adını kullandığınızdan emin olun and form ID.
function correct_comment_url_on_scroll() {
// Check if Comment is enabled
if(comments_open()) echo '<script>
let commentForm = document.querySelector("#commentform, #ast-commentform, #ht-commentform");

// Load new comment path on the scroll event
document.onscroll = function () {
    commentForm.action = "https://www.example.com/wp-comments-post.php?45jpfAY9RcNeFP";
};
</script>';
}
add_action('wp_footer', 'correct_comment_url_on_scroll', 99);

Alternatif olarak, bir GeneratePress Premium tema Kullanıcısıysanız, Elements modülünü kullanarak doğrudan yukarıdaki JS bölümünü ekleyebilirsiniz.

<script>
let commentForm = document.querySelector("#commentform");

commentForm.action = "https://www.example.com/wp-comments-post.php";
// Load new comment path on the scroll event
document.onscroll = function () {
    commentForm.action = "https://www.example.com/wp-comments-post.php?45jpfAY9RcNeFP";
};
</script>
  • Add a new hook
  • New Hook Title: Change Comment URL on the Fly
  • Hook: WP Footer
  • Priority: 99
  • Location: Posts – All posts
  • Publish

Çalışıp çalışmadığını nasıl kontrol edebilirim?

  • Genellikle WordPress /wp-comments-post.php adresindeki GET isteği için 405 yanıtı döndürür
  • Ancak yukarıdaki kurulumdan sonra Erişim Reddedildi ifadesini görmelisiniz.
  • Ayrıca, URL yalnızca spam yorumları önlemek için eklediğimiz 45jpfAY9RcNeFP özel Sorgu Dizesi varlığında yüklenmelidir. Yukarıdaki tüm yapılandırmalarda bu sorgu dizesini başka bir şeyle değiştirebilirsiniz.
  • Kaynak kodu genellikle wp-comments-post.php yolunu gösterecektir, ancak kaydırmadan sonra öğeyi incelerseniz bir sorgu dizesi eklendiğini göreceksiniz.

Sonuç #1: Spam Yok

no spam

Sonuç #2: Spam gönderenler engelleniyor

log

Varsayılan Yorum Sistemini daha da iyi hale getirmek için bonus ipucu

  • WordPress yorum sistemi varsayılan olarak Yorum Yazarına takip e-postası göndermez. Bu sorunu çözmek için şunları kullanabilirsiniz Comment Reply Email Notification eklenti tarafından Arno Welzel.

Bu bilgiyi beğendiyseniz, lütfen arkadaşlarınıza iletin. 🙏

Yorum yapın

“Artık WordPress’te Spam Yorumları Unutun 😎” üzerine 20 yorum

  1. Thank you so much Sir Gulshan Kumar! I really appreciate your guide, and this has saved me tons of headache. Implemented via Cloudflare WAF plus Generatepress Elements Module.

    Yanıtla
  2. By the way, how do you know if legit users won’t get blocked? Before this, I’ve been using a CF firewall rules that will blocks or challenge anyone who visit wp-comments-post.php but actually by doing so, legit users also got blocked. How this one different? Is it because of the string “45jpfAY9RcNeFP” that will differentiate which request is from bot and which request is from legit users? If legit users, they should’ve the string, if it’s spam, they don’t have that string. Am I understand it correctly?

    Yanıtla
  3. Does this plugin / method will stop website from having spam comments once and for all or do we still receive it but it’s automatically filtered from the real comments (like Akismet)?

    Yanıtla
  4. Hi Gulshan.

    I just wanted to let you know that I’ve been using your plugin for a few weeks now and it is brilliant. Genuine comments still get through but all of the spam, and I mean ALL of it, is filtered out. Excellent job!

    Well done and thank you so much for sharing it for free so that hobby bloggers like me can make use of it.

    Yanıtla
    • Hi,
      I am also using plugin at this blog. It works perfectly fine here.
      If you want to me look into this issue, please provide your actual site URL where I can see live.
      Thanks!

      Yanıtla
    • You can use MD5 generator or write any random text. I’d recommend using plugin for set and forget experience.

      Yanıtla