📥 My Awesome Plugin
This plugin helps you automate tasks and improve web performance.
⬇️ Download Plugin ZIP💌 Subscribe to Updates
This WordPress Free plugin called “Old Post Cleaner” that automatically removes old post drafts and revisions to keep your database clean and improve site performance. The plugin is designed for non-coders, with a simple settings page to configure cleanup options and a one-click activation process. It will run as a scheduled task to periodically delete drafts and revisions based on user-defined settings, ensuring minimal server load. The plugin is lightweight, secure, and includes an admin page for configuration and instructions.
Old Post Cleaner free plugin
Installation and Setup Instructions
- Download the Plugin:
- Upload to WordPress:
- Zip the wp-old-post-cleaner folder.
- In your WordPress admin dashboard, go to Plugins > Add New > Upload Plugin.
- Upload the zipped folder and click Install Now.
- Activate the Plugin:
- After installation, click Activate Plugin.
- Configure Cleanup Settings:
- In the WordPress admin dashboard, go to the new menu item called Post Cleaner.
- Configure the following:
- Enable Draft Cleanup: Check to delete old drafts (default: enabled).
- Draft Age (Days): Set how old drafts must be to be deleted (default: 30 days).
- Enable Revision Cleanup: Check to delete old revisions (default: enabled).
- Revision Age (Days): Set how old revisions must be to be deleted (default: 30 days).
- Cleanup Frequency: Choose how often to run the cleanup (Daily, Weekly, or Monthly; default: Daily).
- Click Save Changes.
- Monitor Cleanup:
- The plugin runs automatically based on your chosen frequency.
- No manual intervention is needed after setup.
Features
- Automatic Cleanup: Deletes old drafts and revisions based on user-defined age thresholds.
- Customizable: Settings for enabling/disabling draft and revision cleanup, age limits, and frequency.
- Scheduled Task: Uses WordPress cron to run cleanup efficiently, minimizing server load.
- Simple Interface: Easy-to-use settings page for non-coders.
- Admin Instructions: Includes guidance on the settings page.
- Single File: All functionality is contained in one PHP file.
- Secure: Uses WordPress best practices for database queries and data sanitization.
How It Works
- On activation, the plugin schedules a cleanup task based on your chosen frequency (daily, weekly, or monthly).
- The cleanup task checks for drafts and revisions older than the specified number of days.
- Old drafts and revisions are permanently deleted from the database using WordPress functions.
- The plugin supports posts, pages, and custom post types with drafts or revisions.
- The task is cleared when the plugin is deactivated to prevent orphaned schedules.
Notes
- Permanent Deletion: Deleted drafts and revisions cannot be recovered. Use a database backup plugin (e.g., UpdraftPlus) for safety.
- Database Impact: Cleanup reduces database size, potentially improving site performance.
- Compatibility: Works with WordPress 5.0 and above.
- Performance: Uses direct database queries for efficiency but processes deletions individually to ensure safety.
- Cron Dependency: Relies on WordPress cron, which requires site visits to trigger. For low-traffic sites, consider a server cron job or a plugin like WP Crontrol.
This plugin is ready to use and provides a simple way to keep your WordPress database clean by removing old drafts and revisions. Let me know if you need additional features (e.g., manual cleanup button, excluding specific post types, or logging deleted items) or help with setup!