Custom AntiSpam for WordPress
Experimental WordPress antispam plugin; work in progress.
by Your Name · github.com/akrmba/wordpress-antispam · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/akrmba/wordpress-antispam/archive/refs/heads/main.zipA comprehensive WordPress plugin for advanced spam filtering with customizable blocked words management. Compatible with Newspaper 12 theme and all WordPress themes that use the standard comment system.
Features
📝 Comprehensive Word Management
- Exact Match Words: Block complete words only (case-insensitive)
- Partial Match Words: Block words containing specific patterns
- Safe Words (Whitelist): Never block these words, even if they match other rules
- One word per line format: Easy to read and edit
🚀 Smart Functionality
- Common Spam Words: Pre-fill with typical spam keywords
- Test Word Feature: Check if words would be blocked
- Import/Export: Plain text file support for word lists
- Word Count Display: See how many words are in each list
- Reset to Default: Easily restore original settings
🔧 User-Friendly Interface
- Clean, modern WordPress admin interface
- Tabbed organization for different word types
- Real-time word counting
- Visual feedback for all actions
🔒 Advanced Protection
- Automatic comment filtering on WordPress sites
- Visual spam indicators in admin
- Statistics tracking (spam blocked, texts checked)
- Activity logging with detailed reports
💾 Backup & Recovery
- Complete Backup System: Export all lists as JSON
- Import from Backup: Restore from previous backups
- Foolproof Recovery: Never lose your settings
🎨 Theme Compatibility
- Newspaper 12 Theme: Fully compatible
- All WordPress Themes: Works with any theme using standard comment system
- Custom Post Types: Filters comments on all post types
Installation
Method 1: Manual Installation
- Download the plugin files to your computer
- Upload to WordPress:
- Go to your WordPress admin → Plugins → Add New → Upload Plugin
- Choose the plugin zip file and click "Install Now"
- Activate the plugin
Method 2: FTP Installation
- Extract the plugin files to a folder named
custom-antispam-wordpress - Upload via FTP:
- Connect to your server via FTP
- Navigate to
/wp-content/plugins/ - Upload the
custom-antispam-wordpressfolder
- Activate the plugin in WordPress admin → Plugins
Method 3: Direct File Upload
- Upload files directly to
/wp-content/plugins/custom-antispam-wordpress/ - Activate the plugin in WordPress admin
Configuration
Initial Setup
- Activate the plugin following the installation steps above
- Access settings: Go to WordPress admin → AntiSpam (in the left menu)
- Configure general settings on the main dashboard
- Manage word lists: Click "Word Lists" to configure your filtering rules
Managing Word Lists
Exact Match Words
- Enter words that should be blocked only when they appear as complete words
- Example: "spam" will block "spam" but not "antispam"
Partial Match Words
- Enter patterns that should be blocked if they appear anywhere within words
- Example: "viagra" will block "viagra", "v1agra", "buyviagra", etc.
Safe Words (Whitelist)
- Enter words that should never be blocked
- These override both exact and partial match rules
- Useful for legitimate words that might trigger false positives
Using the Features
Adding Common Spam Words
- Go to AntiSpam → Word Lists
- Click "Add Common Spam Words" button for any list
- Predefined spam keywords will be added to your list
Testing Words
- Go to AntiSpam → Test Filter
- Enter text you want to test
- Click "Test Text" to see what would be blocked
Import/Export Word Lists
- Import: Click "Import List" and select a
.txtfile (one word per line) - Export: Click "Export List" to download your current list
Backup & Restore
- Backup All Lists: Creates a complete JSON backup of all your settings
- Restore From Backup: Import a previously created backup file
Admin Interface
Main Dashboard
- Statistics Overview: See spam blocking statistics at a glance
- General Settings: Configure plugin behavior and sensitivity
- Quick Actions: Easy access to word management and testing
- Theme Compatibility Info: Details about Newspaper 12 and other themes
Word Lists Management
- Three separate sections for exact, partial, and safe words
- Real-time word counting for each list
- Common word buttons for quick setup
- Reset to default functionality
- Import/Export capabilities
Test Filter
- Live testing of text against current word lists
- Word-by-word analysis showing what would be blocked
- Sample test cases for quick testing
- Current settings overview
Activity Log
- Detailed statistics of spam blocking activity
- Most blocked words analysis
- Pagination for large log files
- Bulk actions for log management
- Export capabilities
Configuration Examples
Basic Setup
Exact Words: spam, scam, lottery, prize
Partial Words: viagra, cialis, pills
Safe Words: the, and, hello, thanks
Advanced Setup
Exact Words:
- Financial scams: loan, debt, mortgage, refinance
- Gambling: casino, lottery, jackpot, winnings
- Urgency: urgent, immediate, expires, limited
Partial Words:
- Medical spam: pill, drug, prescription, enhancement
- Marketing: amazing, incredible, revolutionary, breakthrough
Safe Words:
- Common words: the, and, or, but, in, on, at
- Polite words: please, thanks, hello, sorry
Settings Options
General Settings
- Enable AntiSpam Protection: Turn filtering on/off
- Action for Spam Comments: Choose how to handle spam
- Hold for Moderation (recommended)
- Mark as Spam
- Delete Immediately
- Sensitivity Level: Low, Medium, or High
- Whitelist Registered Users: Skip checking for logged-in users
- Log Activity: Track spam attempts for analysis
- Notification Email: Email for spam notifications
Block Actions
- Hold for Moderation: Comments are held for admin review
- Mark as Spam: Comments are automatically marked as spam
- Delete Immediately: Comments are deleted without notification
Theme Compatibility
Newspaper 12 Theme
The plugin is fully compatible with Newspaper 12 theme and will filter comments in:
- Article comments
- Page comments
- Custom post type comments
- Any other comment areas using WordPress comment system
Other Themes
Works with any WordPress theme that uses the standard WordPress comment system:
- Twenty Twenty-Four
- Astra
- Divi
- Elementor themes
- Custom themes
Database Structure
The plugin creates two database tables:
wp_custom_antispam_words
- Stores word lists (exact, partial, safe)
- Includes timestamps for tracking
wp_custom_antispam_logs
- Stores spam blocking activity
- Tracks IP addresses, user agents, and match details
File Structure
custom-antispam-wordpress/
├── custom-antispam-wordpress.php # Main plugin file
├── includes/
│ ├── admin-main.php # Main dashboard
│ ├── admin-words.php # Word management
│ ├── admin-test.php # Test filter
│ └── admin-logs.php # Activity logs
├── assets/
│ ├── admin.css # Admin styling
│ └── admin.js # Admin JavaScript
└── README.md # This file
Tips for Best Results
- Start Small: Begin with a few obvious spam words and expand gradually
- Test Regularly: Use the test feature to avoid blocking legitimate content
- Use Safe Words: Add common legitimate words to prevent false positives
- Regular Backups: Export your settings periodically
- Monitor Stats: Check the statistics to see how effective your filtering is
- Review Logs: Regularly check the activity log for patterns
Troubleshooting
Plugin Not Working
- Ensure it's enabled in the plugins page
- Check that the toggle in settings is set to "on"
- Verify WordPress comment system is active
False Positives
- Add legitimate words to the Safe Words list
- Review your Partial Match words for overly broad patterns
- Use the Test feature to verify your settings
Missing Features
- Make sure you're using the latest version
- Clear WordPress cache and reload
- Check browser console for error messages
Database Issues
- Deactivate and reactivate the plugin
- Check WordPress database permissions
- Verify table creation in database
Privacy & Security
- No Data Collection: All word lists are stored locally in your WordPress database
- No Network Requests: The plugin works entirely offline
- No Tracking: No usage statistics are sent anywhere
- Local Storage Only: Uses WordPress database for all storage
- Secure: Follows WordPress security best practices
Performance
- Lightweight: Minimal impact on site performance
- Efficient: Optimized database queries
- Caching: Uses WordPress caching when available
- Scalable: Handles large word lists efficiently
Support
If you encounter issues or have suggestions:
- Check the WordPress debug log for error messages
- Try disabling and re-enabling the plugin
- Clear WordPress cache and reload
- Check database permissions and table creation
- Review the activity log for clues
Version History
- v1.0.0: Initial release with full word management system
- Complete admin interface
- Database integration
- Import/Export functionality
- Test filter
- Activity logging
- Newspaper 12 compatibility
Requirements
- WordPress: 5.0 or higher
- PHP: 7.4 or higher
- MySQL: 5.6 or higher
- Browser: Modern browsers with JavaScript enabled
License
This plugin is licensed under the GPL v2 or later.
Credits
Developed for WordPress with compatibility for Newspaper 12 theme and all standard WordPress themes.
Made with ❤️ for a spam-free WordPress experience