Let’s say you import events into The Events Calendar using Event Aggregator to fetch events from another calendar and that first import goes a-ok.

However, on the next import, what? You end up with a bunch of the same events on the same days.

While it’s uncommon, there are circumstances where Event Aggregator will fetch the same event twice, resulting in duplicated calendar events. This is usually the result of something happening with the source calendar of those events, like the ID of an event changing between imports.

We’ve created a snippet to help you remove duplicate imported events from your site.

  1. Install the free Code Snippets plugin.
  2. In your dashboard, go to Snippets > Add New. Copy this snippet and paste it into the field.
  3. Under the snippet field, select Only run in administration area (here).
  4. Click the Save changes and activate button.
  5. From the Dashboard menu, click Events. The snippet will start to run and the page will take longer than usual to load. Stay on the page until it loads, and you’ll see the duplicates have been moved to Ignored status. This may take a little while depending on how many duplicate events there are.
  6. Go back to Snippets > All Snippets. Once again, the page will take longer than expected to load. During this time the Ignored events will be permanently deleted.
  7. Deactivate or delete the snippet.

Dealing with thousands of duplicates

If you’ve got a huge number of duplicate events, processing them all can take quite a while. In this case, you might choose to remove them in batches instead of all at once. The process is very similar, but uses a slightly different snippet that includes a built-in limit. Each time the snippet runs, it will process up to 1000 events. You can adjust the snippet if you’d like to change that number.

  1. Install the free Code Snippets plugin.
  2. In your dashboard, go to Snippets > Add New. Copy this snippet and paste it into the field.
  3. Optional: adjust the limit in line 6 to set how many events will be processed per batch.
  4. Under the snippet field, select Only run in administration area (here).
  5. Click the Save changes and activate button.
  6. From the Dashboard menu, click Events. Stay on the page until it loads, and you’ll see that some duplicates have been moved to Ignored status. Reload the page and you’ll see another batch processed.
  7. Refresh the page as many times as you need until the duplicate events have been fully removed and you no longer see them listed under Ignored.
  8. Go back to Snippets > All Snippets and deactivate or delete the snippet.