WP All Import Add-On for The Events Calendar
This extension is needed in order to successfully migrate The Events Calendar and/or Event Tickets data from one WordPress site to another. This is the glue between The Events Calendar/Event Tickets and WP All Import Pro (premium).
Compatibility
Currently, this add-on supports the following calendar and ticket data to be migrated:
- Venues
- Organizers
- Single events, including all-day and multi-day events
- RSVPs and attendees
- Tickets Commerce tickets, orders, and attendees
The add-on currently DOES NOT support the following data types:
- Recurring events
- Event Series
- Event Tickets Plus/WooCommerce tickets, orders, and attendees
Adding support for these is on our roadmap.
Requirements
- The Events Calendar – for event-related data
- Event Tickets – for ticket and attendee-related data
- WP All Export (free) on the source site where you are migrating events from.
- WP All Import Pro (premium) on the destination site to which you are migrating events.
- WP All Import Add-On (this extension) on the destination site to which you are migrating events.
Preamble
The migration process is fairly simple: the data needs to be exported from one site and needs to be imported into the other site. This has to be done for every post type you would like to migrate separately. It is as easy as it sounds. Still, there are a few details to pay attention to to make sure the migration is successful.
Consider cleaning up event data on the destination site to start with a clean slate. Without that, you might get unexpected results, including some data getting deleted.
It is always good to create a database backup of the destination site before starting the migration. To prevent any surprises, it is even better to test the migration on a staging site first, which should be an exact copy of the live destination site. The Events Calendar is not responsible for any data loss.
“Lock” the site
When you start exporting the data from the source site, make sure that you “lock” the data so that there are no more changes when you are midway through the export. Otherwise, the data can be corrupted after migration.
The order of the import
The different post types of The Events Calendar and Event Tickets plugins (more details in the next paragraph) are linked together in a certain way. This is why it’s really important that the different post types are imported in a certain order. Otherwise, they cannot be re-linked during the import, and the migration will not be successful.
Here is the order in which the post types have to be imported. Of course, if you are not migrating a certain post type, you can skip that.
Data type | Post type |
Venues | tribe_venue |
Organizers | tribe_organizer |
Events | tribe_events |
RSVP “Tickets” | tribe_rsvp_tickets |
RSVP Attendees | tribe_rsvp_attendees |
Tickets Commerce Tickets | tec_tc_ticket |
Tickets Commerce Orders | tec_tc_order |
Tickets Commerce Attendees | tec_tc_attendee |
The Migration Process
Exporting the data
We are going to assume that The Events Calendar, WP All Export (free or pro), and this extension are installed and activated on the source site.
- On the WordPress dashboard, head over to WP Export > New Export.
- Choose “Specific Post Type”, and from the dropdown, select the post type you would like to export.
- After choosing the post type, you will see a notification showing how many will be exported.
- If you have WP All Export Pro installed, you can add further filtering options in case you only want to export posts with specific properties.
- Click on the blue “Migrate” button, which will take you to the last step before the export.
- On the Export Settings page, you can choose some advanced settings to customize your export further. These are mostly useful if you plan to run the export multiple times or regularly. For the migration to be successful, you don’t need to worry about these settings.
- To start the export, you can click on the green “Confirm & Run Export” button on the top right or the blue “Save & Run Export” at the bottom of the screen. This will start gathering the data, which will then be packaged in a file for you to download.
- When the export reaches 100%, you will be able to download the exported data in two formats: a CSV file or a “Bundle” (which is a .zip file). You will need the bundle, so click on the blue “Bundle” button, and save the offered .zip file to your PC.
The export for this post type is done. Repeat the above steps for all post types you would like to migrate.
Importing the data
We are going to assume that The Events Calendar, WP All Import Pro, and this extension are installed and activated on the destination site.
When importing the different calendar and ticket data, pay attention to the order in which the different data types are imported. Please check the details in the “The order of import” paragraph above.
- On the WordPress dashboard, head over to All Import > New Import.
- Choose Upload a file and select the bundle .zip file you have downloaded before.
- If the file has been uploaded before and you are re-running the import, you can select “Use existing file” instead.
- This will upload the file, and WP All Import will try to select the right post type automatically.
If you don’t have the plugin activated, which handles the post type you are trying to import, then WP All Import will not recognize it, and you will not be able to select it from the dropdown. As a result, the import will not work as expected.
- Click on the grey “Skip to step 4” button, which will take you to the import settings page.
- Alternatively*, you can click on “Continue to Step 2” to review your import file. You have the possibility to filter which posts you would like to import.
- In Step 3, you can map the incoming data elements to the correct post fields.
- On the Import Settings page, the most important part is the Unique Identifier field. This should already be automatically filled with “{id[1]}” to signal that the ID column has the unique identifiers for the posts.
There are some other settings on this page that you can use to fine-tune the import. If you want to import everything, there’s nothing more to do.
Click on the blue “Continue” button at the bottom, which will take you to the confirmation page.
- On the confirmation page, you can double-check the import summary. If you find everything is in order, then click on the green “Confirm & Run Import” button.
- On the next screen, you can follow the progress of the import. The import finishes successfully when you see “Import Complete!”
- To verify that your import succeeded, review the new events under Events > All Events.
The import for this post type is done. Repeat the above steps for all post types you would like to import, with attention to the order of the import.
* For more detailed information on how the export and import works with WP All Export/Import, visit their documentation.
Logging
WP All Export/Import keeps a detailed log of its actions. The logs can be downloaded and reviewed after an import/export is done.
The Events Calendar also adds its own entries to the logs, which can provide information in case something doesn’t work out. These log entries are colored blue to make them stand out.
Advanced Topics, Hooks
Forcing the import when related post type is missing
There are post types that are linked to a different post type and would not work without them. For example, an RSVP attendee depends on the RSVP ticket and the Event (or post type) the RSVP ticket is linked to. If any of those are missing, the RSVP attendee will not be imported.
It is possible to override this behavior with a filter and force the RSVP attendees to be imported, even if the related ticket or event (post) doesn’t exist. To do that, you can use this filter.
apply_filters( 'tec_labs_wpai_force_import_' . $data['posttype'], false, $data, $import_id )
where $data['posttype']
is the post type we want to force-import.
As an example, for the abovementioned RSVP attendees post type, the snippet would look like this:
add_filter( 'tec_labs_wpai_force_import_tribe_rsvp_attendees', function() { return true; } );
This will force all RSVP attendees that are missing a link to a ticket or event to be imported.
Keeping empty metadata
Post types can build up a lot of metadata, and some of those might have empty values. During import, the metadata that is empty will be skipped to minimize unnecessary data.
There are two ways to override this.
Force all
With the following filter, you can force all empty metadata to be imported.
apply_filters( 'tec_labs_wpai_keep_empty_meta', false );
A snippet that would go into your functions.php file looks like this:
add_filter( 'tec_labs_wpai_keep_empty_meta', function() { return true; } );
Force selected
There’s also a filter that will let you define the meta keys that you would like to keep when they have an empty value. It accepts an array of meta keys.
apply_filters( 'tec_labs_wpai_keep_post_meta_meta_keys', $keep_post_meta_meta_keys );
The snippet would look like this:
add_filter( 'tec_labs_wpai_keep_post_meta_meta_keys', 'tec_wpai_keep_empty_meta_keys' );
function tec_wpai_keep_empty_meta_keys( $keep_post_meta_meta_keys ) {
$keep_post_meta_meta_keys = [
'my_custom_meta_key_1',
'my_custom_meta_key_2',
];
return $keep_post_meta_meta_keys;
}
Mismatching post type
When importing a post type WP All Import makes it possible to import it as a different post type. For example, you can export the “posts” post type from one site and import them as “pages” post type on another site.
With The Events Calendar and Event Tickets-related data, this is not allowed by default. However, this can also be overridden with a filter.
If you add the following line to your functions.php file, then you will be able to import events and ticket-related post types as something else. Note this only affects post types of The Events Calendar and Event Tickets. It does not have any effect on other post types.
add_filter( 'tec_labs_wpai_delete_mismatching_post_type', function() { return false; } );
Changelog
- 1.0.0
- October 17, 2023
- Initial release