Automatic Message Cleanup for Chat Rooms
Per-room automatic cleanup — clear all messages on a daily or weekly schedule at a chosen time, or keep only the latest N messages with older ones trimmed automatically.
Each chat room gets an Automatic Message Cleanup section in its editor with three modes. Off — the default, nothing is ever deleted. Clear all messages on a schedule — every message in the room is deleted once the scheduled moment passes, daily or weekly at a chosen time, interpreted in the site timezone. Keep only the latest messages — a rolling cap that silently trims the oldest messages whenever the room exceeds the configured maximum.
After each scheduled wipe a system notice — "Chat history was cleared automatically" — is posted in the room so returning members understand why the history is empty. The notice only appears when the wipe actually deleted something, and participants and room settings are never touched. The room editor shows Next cleanup and Last cleanup timestamps next to the schedule fields.
Cleanup runs on the existing five-minute cleaner job and deletes in batches, so even rooms with tens of thousands of messages clean themselves without timing out. Developers get batch-size filters and a better_messages_chat_room_auto_cleanup action. Works in both the free and WebSocket versions.