Skip to content

fabiomb/wp-antispammer

Repository files navigation

WP AntiSpammer

Lightweight, configurable anti-spam plugin for WordPress comments. Detects and blocks spam based on configurable rules without requiring external services.

Description

WP AntiSpammer is a free, self-contained alternative to cloud-based anti-spam services. All detection runs locally on your server using configurable rules and lists. No data is sent to third parties.

Features

  • 13 configurable rules — each can be independently enabled/disabled
  • Custom lists — blocked domains, email domains, TLDs, languages, and alphabets
  • Batch processing — scan existing pending/approved comments against current rules
  • Statistics dashboard — track detections by rule, daily history, and spam rate
  • Two spam actions — mark as spam or hold as pending for manual review
  • Lightweight — no external API calls, no JavaScript on the frontend, no database tables

Rules

Rule Description
Language detection Blocks comments written in specific languages (requires minimum word count for reliable detection)
Alphabet detection Blocks comments where a percentage of characters belong to a blocked script (Cyrillic, Chinese, Arabic, etc.)
Contains links Any comment with a link is spam
Too many links Comments exceeding a configurable link threshold
Blocked TLD Links pointing to blocked country TLDs (.ru, .cn, .tr, etc.)
Blocked domain Links pointing to specific blocked domains
Blocked email domain Author email from a blocked domain (tempmail, throwaway, etc.)
Short comment Comments below a minimum character length
Long comment Comments above a maximum character length
Author name has URL Author name field contains a URL
All caps Comments written mostly in uppercase
Repeated characters Excessive character repetition (e.g., "aaaa", "!!!!")
BBCode / spam markup Comments containing [url], [link], [img] BBCode tags

Lists

  • Blocked domains — specific domains blocked in comment links
  • Blocked email domains — email providers considered spam sources
  • Blocked TLDs — country-code TLDs blocked in comment links
  • Blocked languages — languages detected via common word analysis (Russian, Chinese, Japanese, Korean, Arabic, Hindi, Turkish, Vietnamese, Thai, Ukrainian)
  • Blocked alphabets — character scripts: Cyrillic, Chinese (CJK), Japanese, Korean, Arabic, Thai, Devanagari, Bengali, Hebrew, Greek

Bulk Processing

For sites with existing comments, WP AntiSpammer can scan pending or approved comments in configurable batches (default: 50 per batch) to avoid server overload. Progress is shown in real-time via AJAX.

Installation

  1. Upload the wp-antispammer folder to /wp-content/plugins/
  2. Activate the plugin through the Plugins menu in WordPress
  3. Go to AntiSpammer in the admin menu
  4. Enable the rules you want and configure their thresholds
  5. Add items to the lists (domains, TLDs, languages, alphabets)
  6. Optionally run bulk processing on existing comments

Frequently Asked Questions

Does this plugin send data to external services?

No. All processing happens locally on your server. No external API calls are made.

Can I use this alongside Akismet?

Yes. WP AntiSpammer hooks into preprocess_comment with priority 1, so it runs before most other plugins. If a comment passes WP AntiSpammer, Akismet (or any other plugin) can still evaluate it.

What happens when a comment is detected as spam?

Depending on your configuration, it's either marked as spam directly or held as pending for manual review.

How does language detection work?

The plugin uses a lightweight approach based on common word lists for each language. If the comment has fewer words than the configured minimum (default: 5), language detection is skipped to avoid false positives.

How does alphabet detection work?

The plugin counts characters belonging to specific Unicode ranges (e.g., Cyrillic: U+0400–U+04FF). If the percentage exceeds the configured threshold (default: 50%), the comment is flagged.

Requirements

  • WordPress 5.6+
  • PHP 7.4+
  • mbstring PHP extension

Author

Fabio Baccaglioni

License

GPL-2.0-or-later. See LICENSE.

About

Small plugin to block spam from different languages and origins when Akismet is not available

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors