Added acd_increase_comments_per_page to set edit_comments_per_page to a high value (9999) during bulk actions (acd_move_to_spam, acd_permanent_delete), ensuring all selected comments are processed.
The admin notice uses _n for proper singular/plural messaging, showing the exact count of comments affected.
Move to Spam Folder:
Replaced the "Permanently Delete" bulk action with "Move to Spam" (acd_move_to_spam), which uses wp_set_comment_status to mark comments as spam.
Kept "Permanently Delete" as a separate bulk action for use in Spam/Trash folders.
Select All in Spam/Trash:
The acd_permanent_delete action is available in the Spam and Trash folders (accessible via edit-comments.php?comment_status=spam or comment_status=trash).
Selecting all comments (via the checkbox or bulk select) and choosing "Permanently Delete" moves them to the wp_deleted_comments table and removes them from the database using wp_delete_comment.
Restore System:
The restore page (Comments > Restore Comments) lists comments in the wp_deleted_comments table, allowing restoration of comments deleted manually or via auto-deletion.
Restoration uses wp_insert_comment to reinsert comments.
Existing Features:
Auto-deletion cron job remains unchanged, deleting comments older than 1 day (configurable) and storing them in wp_deleted_comments.
Auto-update support continues to check https://softaculas.com/api/auto-comment-detection.json.
PHP 8.2 compatibility is maintained with type hints and safe serialization.
Installation Instructions
Package the auto-comment-detection/ folder into a .zip file (e.g., auto-comment-detection.zip).
In the WordPress dashboard, go to Plugins > Add New > Upload Plugin, upload the .zip, and activate.
Configure settings under Comments > Auto Detection, including auto-deletion options.
Access spam comments under Comments > Spam and restore options under Comments > Restore Comments.
Ensure PHP 8.2 and WordPress cron are enabled.
Usage
Move to Spam: Select comments in the Comments page, choose "Move to Spam" from bulk actions. All selected comments (not just 20) are moved to the Spam folder with a notice (e.g., "25 comments moved to Spam").
Permanent Delete from Spam/Trash: In the Spam or Trash folder, select all comments (using the top checkbox or selecting across pages) and choose "Permanently Delete" to move them to the wp_deleted_comments table and remove them from the database.
Restore: Visit Comments > Restore Comments to recover deleted comments.
Auto-Deletion: Comments older than 1 day (configurable) are automatically deleted and stored for restoration.
Updates: The plugin automatically checks for updates if the update server is configured.
Notes
Backup: Always back up your database before using bulk deletion or auto-deletion, as permanent removal is irreversible without restoration.
Spam/Trash: The "Select All" checkbox in the Spam/Trash page works with pagination; ensure all desired comments are selected.
Cron: WordPress cron must be active for auto-deletion to function; use a server cron job if WP_Cron is disabled.
Compatibility: Tested with WordPress 4.7+, PHP 8.2; uses core APIs for compatibility.