Bright Labs

How to delete old past events in The Events Calendar, in bulk or on a schedule

Your events list is full of dates that ended months ago, and you want them gone without opening each one. Here are two ways to do it. You can select a page of old events in Events → All Events and move them all to the Trash at once. Or you can turn on the cleanup setting under Events → Settings → General → Maintenance, called Move to trash events older than. Either way the events go to the Trash first, and by default WordPress deletes them for good once they've been there for more than 30 days.

Back up before you delete anything

The Nexcess documentation for The Events Calendar strongly recommends a full site backup first, and it says plainly that deleting content can't be undone without a backup. The Trash gives you a window to restore events trashed by mistake, but don't count on it alone.

The same page also covers an SQL route, and that one permanently deletes all events from your database. Keep it for last, and only use it if you have that backup ready.

See which events are already past

The Events Calendar is set up to focus on current and upcoming events. The past events list is at events/list/?eventDisplay=past on your site. That's a quick way to see what you're about to clear out.

In the admin, you'll work from Events → All Events. Check the dates on each page before you select anything.

Trash old events in bulk from the admin list

Use this one for a one-time cleanup.

If you want them gone right away instead of waiting for the Trash to clear, open the Trash tab and click Empty Trash. After that, only a backup brings them back.

Let the calendar trash old events on a schedule

To stop past events from piling up again, go to Events → Settings → General → Maintenance and set Move to trash events older than. It only moves events to the Trash. It doesn't delete them permanently, so the Trash window still applies.

The catch: it works in small batches. It runs twice a day and handles 15 events per run, which is 30 events per day in total. The docs explain why: servers, especially shared ones, can become overwhelmed if too many processes happen at once. They also warn that clearing a large backlog can take several days or longer.

In short, if you have a big pile of old events, clear it once with the bulk steps above. Then turn on the setting so it keeps up from there.

How long trashed events stay, and how to change it

By default, WordPress automatically deletes any post, events included, once it has been in the Trash for more than 30 days. Until then, you have a window to restore an event you trashed by mistake.

That window comes from the EMPTY_TRASH_DAYS constant in wp-config.php. It sets the number of days before WordPress permanently deletes posts, pages, attachments and comments from the trash bin, and the default is 30. Setting it to zero turns the Trash off completely. Then WordPress won't ask for confirmation when someone clicks Delete Permanently. On a calendar where several people edit events, keep at least a few days of Trash.

Imported events behave differently

If your events come in through Event Aggregator, trashing one doesn't work the way you might expect. When you move an imported event to the Trash, Event Aggregator puts it on the Ignore list instead, so the same event isn't imported again later.

This one is easy to miss: events on the Ignored list aren't deleted automatically by WordPress. If you want them gone, you'll need to clear that list yourself.

When the old dates belong to one weekly series

If the past dates came from a weekly series you made with RecurKit, our free plugin for The Events Calendar, you can also delete the whole series at once under Events > Series. That removes the upcoming dates as well, so it's only right for a series that has ended. If the series is still running, use the bulk steps above on the past dates only. Each RecurKit occurrence is an ordinary event, and you can still edit any single date in the normal editor.

Sources

Questions

Does Move to trash events older than delete events permanently?

No. It only moves events to the Trash. WordPress then deletes them for good after they have been in the Trash for more than 30 days, unless you changed EMPTY_TRASH_DAYS in wp-config.php.

I turned the setting on, so why are my old events still there?

It runs twice a day and trashes 15 events per run, which is 30 a day. A large backlog can take several days or longer. Trash most of them in bulk from Events → All Events, and let the setting handle what's left.

Will an imported event come back if I trash it?

No. When you trash an event imported with Event Aggregator, it goes on the Ignore list, so it isn't imported again. WordPress doesn't delete events on the Ignored list automatically, so you'll need to clear that list yourself.

Can I get back an event I trashed by mistake?

Yes, as long as it's still in the Trash. By default, WordPress deletes it once it has been there for more than 30 days. After you click Empty Trash, only a backup brings it back.

Related