Skip to content

Instantly share code, notes, and snippets.

@alexnnnn
alexnnnn / wp-all-import-events-manager.php
Created February 21, 2018 10:35 — forked from jsit/wp-all-import-events-manager.php
Allow WP All Import to create events with Events Manager
// Create a proper EM_Event object in the database when an event-type post is
// imported with WP All import
add_action('pmxi_saved_post', 'post_saved', 10, 1);
function post_saved($post_id) {
if (class_exists(EM_Event)) {
$event_post = get_post($post_id);
// Only create a new event entry if the imported post is of type event and
// there is not an existing event for this post
$existing_event = em_get_event($event_post->ID, 'post_id');