Skip to content

nueleluwa/Auto-Delete-Comments-V1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Auto Delete Comments

Version: 2.0.1
Author: Emmanuel Eluwa
GitHub: github.com/nueleluwa/Auto-Delete-Comments
WordPress Profile: profiles.wordpress.org/luwie93
License: GPL v2 or later

A modern, production-ready WordPress plugin that automatically deletes comments in batches with configurable scheduling, advanced analytics, REST API integration, and a professional admin interface.

WordPress Version PHP Version License Version Status

Quality Ratings

  • Code Quality: A+ (WordPress VIP Standards)
  • Security: A+ (No vulnerabilities)
  • Performance: Excellent (Optimized queries)
  • Documentation: Comprehensive (10+ guides)

Features

Core Features

  • Automatic Comment Deletion - Schedule batch deletions with WordPress cron
  • Flexible Scheduling - Every 1-60 minutes with reliable cron system
  • Selective Deletion - Choose comment types (spam, pending, approved, trash)
  • Age Filtering - Delete only comments older than X days
  • Batch Processing - 1-50 comments per run (prevents server errors)
  • Activity Logging - Track last 100 deletion activities
  • Manual Controls - Delete batch immediately with one click

Professional Interface (v2.0+)

  • Real-Time Statistics - Live comment counts with auto-refresh
  • Advanced Analytics - 30-day tracking with Chart.js visualizations
  • REST API - Full API access for headless WordPress
  • Modern Dashboard - Clean, WordPress-native design
  • Author Section - Professional plugin branding
  • Performance Optimized - Efficient queries and minimal resource usage
  • Security Hardened - WordPress VIP coding standards compliant
  • Fully Responsive - Mobile-first design

Installation

Method 1: Upload ZIP

  1. Download the latest release
  2. Go to WordPress Admin β†’ Plugins β†’ Add New β†’ Upload
  3. Choose the ZIP file
  4. Activate the plugin

Method 2: Manual Installation

  1. Extract the plugin folder
  2. Upload to /wp-content/plugins/
  3. Activate via WordPress admin

Quick Start

Basic Configuration (Safe)

Enable Auto Delete: OFF (configure first)
Batch Size: 15 comments
Interval: 5 minutes
Delete Types: Spam βœ“ | Trash βœ“
Older Than: 0 days

First Steps

  1. Go to Settings β†’ Auto Delete Comments
  2. Review current comment statistics
  3. Configure your preferences
  4. Click "Delete Batch Now" to test
  5. Check deletion history
  6. Enable automatic deletion

Screenshots

Main Dashboard

The plugin features a modern, clean interface with:

  • Real-time Statistics - Live comment counts by type
  • Settings Panel - Easy configuration with toggle switches
  • Status Sidebar - Current plugin status and next run time
  • Analytics Chart - Visual 7-day deletion trend
  • Activity Log - Last 100 deletion events with timestamps
  • Author Section - Professional plugin branding

Key Interface Elements

  1. Statistics Cards - Spam, Pending, Approved, Trash, Total counts
  2. Toggle Switch - Modern on/off control for plugin activation
  3. Settings Form - Batch size, interval, comment types, age filter
  4. Manual Actions - One-click "Delete Batch Now" button
  5. Deletion History - Table showing date, time, and count
  6. Author Card - Photo, bio, and social media links (GitHub, WordPress, Instagram)

Configuration Options

Settings

Setting Range Default Description
Batch Size 1-50 15 Comments deleted per batch
Interval 1-60 min 5 How often to run deletion
Comment Types Multiple Spam, Trash Types to automatically delete
Older Than 0+ days 0 Minimum age in days (0 = all)

Comment Types

  • Spam βœ… (Safe) - Akismet/spam marked
  • Trash βœ… (Safe) - Already trashed
  • Pending ⚠️ (Caution) - Awaiting moderation
  • Approved 🚨 (Danger) - Real user comments

Analytics Dashboard

Metrics Tracked

  • Total Deleted - All-time comment deletions
  • Average Per Run - Efficiency metric
  • Total Runs - Execution count
  • 7-Day Trend - Daily breakdown with interactive chart
  • Comment Distribution - Real-time statistics by type

Dashboard Features

  • Live Statistics - Auto-refresh every 30 seconds when enabled
  • Line Chart - Visual deletion trends over 7 days
  • Deletion History - Last 100 deletion activities with timestamps
  • Manual Actions - One-click batch deletion for testing
  • Status Panel - Current configuration and next scheduled run

REST API

Endpoints

Get Statistics

GET /wp-json/auto-delete-comments/v1/stats

Response:

{
  "spam": 42,
  "pending": 5,
  "approved": 1250,
  "trash": 8,
  "total": 1305
}

Get Analytics

GET /wp-json/auto-delete-comments/v1/analytics

Response:

{
  "total_deleted": 1234,
  "avg_per_run": 15.2,
  "total_runs": 81,
  "last_7_days": {
    "2024-11-06": 50,
    "2024-11-07": 45,
    "2024-11-08": 30,
    ...
  }
}

Authentication

Requires manage_options capability. Use WordPress nonce for AJAX or standard authentication for REST API.

Use Cases

1. Spam Control (Most Common)

Goal: Keep spam under control automatically

Settings:

  • Batch: 20 | Interval: 5 min | Types: Spam + Trash

Result: Deletes 20 spam comments every 5 minutes

2. Old Comment Cleanup

Goal: Remove old spam without touching recent

Settings:

  • Batch: 15 | Interval: 10 min | Types: Spam | Older: 30 days

Result: Deletes spam older than 30 days only

3. Database Maintenance

Goal: Periodic cleanup of all unwanted comments

Settings:

  • Batch: 25 | Interval: 15 min | Types: Spam + Trash | Older: 7 days

Result: Weekly maintenance keeping database clean

Technical Details

Requirements

  • WordPress: 5.8 or higher
  • PHP: 7.4 or higher
  • MySQL: 5.6 or higher

Performance

  • Optimized queries using fields => 'ids'
  • Batch processing prevents timeouts
  • Efficient cron scheduling
  • No memory leaks
  • Maximum 50 comments per batch (prevents URI errors)

Security

  • Nonce verification on all AJAX
  • Capability checks (manage_options)
  • Input sanitization with absint()
  • Output escaping with esc_html(), esc_attr()
  • No direct SQL queries
  • WordPress Coding Standards compliant

Architecture

  • Singleton pattern
  • REST API integration
  • WordPress cron system
  • Analytics tracking system
  • Modular design

Changelog

Version 2.0.1 (2024-11-13) - Current Version

Critical Bug Fixes & Improvements

  • Fixed: Template variable scope issues ($this-> usage in included files)
  • Fixed: Cron scheduling reliability (intervals now registered early)
  • Fixed: Missing output escaping (XSS vulnerability eliminated)
  • Added: Settings validation (prevents enabling without comment types) Added: Professional author section with photo and social links
  • Added: Comprehensive error logging throughout
  • Improved: WordPress-native design for author section
  • Added: Extensive documentation (10+ guides)
  • Added: Code quality validation script

Quality Improvements:

  • A+ Security rating (all vulnerabilities fixed)
  • A+ Code quality (WordPress VIP standards)
  • Production-ready and fully tested
  • 43 KB package with complete documentation

Version 2.0.0 (2024-11-12)

Major Update - Modern Interface

  • Added real-time statistics dashboard
  • Added advanced analytics with Chart.js
  • Added REST API endpoints
  • Added modern card-based UI design
  • Added manual batch deletion controls
  • Added 30-day analytics tracking
  • Added activity logging (last 100 runs)
  • Enhanced user interface
  • Improved data visualization
  • Comprehensive documentation

Version 1.1.0 (2024-11-12)

Security & Bug Fixes

  • Fixed URI error by limiting batch size to 50
  • Fixed cron scheduling bug
  • Added comprehensive security measures
  • 100% WordPress Coding Standards compliance
  • Performance optimizations
  • Better error handling

Version 1.0.0 (2024-11-12)

Initial Release

  • Basic comment deletion functionality
  • Configurable scheduling
  • Comment type selection
  • Activity logging

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Follow WordPress Coding Standards
  4. Write clear commit messages
  5. Test thoroughly
  6. Submit a pull request

Development Setup

git clone https://github.com/nueleluwa/Auto-Delete-Comments.git
cd Auto-Delete-Comments
# Install dependencies if needed
# Run tests

Support

Documentation

Getting Help

Found a bug? Open an issue on GitHub Issues

Need support?

  1. Check the documentation first
  2. Search existing GitHub issues
  3. Create a new issue with:
    • WordPress version
    • PHP version
    • Plugin version
    • Error messages (if any)
    • Steps to reproduce

Feature Requests

Have an idea? We'd love to hear it!

  • Open a GitHub Issue with the "enhancement" label

  • Describe the feature and use case

  • Explain how it would benefit users

License

This plugin is licensed under the GPL v2 or later.

Copyright (C) 2024 Emmanuel Eluwa

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

About the Author

Emmanuel Eluwa is an accomplished Web Developer and WordPress Technical Support specialist with a decade of experience in the industry. He specializes in creating reliable, production-ready WordPress solutions.

Connect

Professional Services

Emmanuel is the Co-Founder of Brela, a website support agency specializing in WordPress solutions for startups and businesses across Africa.

Acknowledgments

  • WordPress Community
  • Brela Team (initial development support)
  • Chart.js for visualization library
  • Contributors and testers

Links

Show Your Support

If this plugin helps you manage your WordPress comments, please consider:

  • ⭐ Star the repository on GitHub
  • πŸ“ Share with the WordPress community
  • πŸ› Report bugs to help improve the plugin
  • πŸ’‘ Suggest features you'd like to see
  • 🀝 Contribute code or documentation
  • πŸ’¬ Review and provide feedback

Every bit of support helps make this plugin better for everyone!


Made with ❀️ by Emmanuel Eluwa

WordPress Development | Technical Support | Plugin Development

GitHub β€’ WordPress Profile β€’ Brela


Auto Delete Comments v2.0.1
Licensed under GPL v2 or later
Β© 2024 Emmanuel Eluwa. All rights reserved.

About

A modern WordPress plugin that automatically deletes comments in batches

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors