WP All Import not totally compatible with Events Manager
-
If you import items with WP All Import as the Event post type created by Events Manager, they aren’t given an Event ID.
The action below should cause Event IDs to be created by Events Manager when events are imported with WP All Import; however they will be saved with the status ‘publish’, regardless of your WP All Import settings.
// 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'); if ($event_post->post_type == 'event' && empty($existing_event->event_id)) { $event = new EM_Event(); $event->load_postdata($event_post); $event->save(); } } }
I’ve also added this as a gist on GitHub in case anybody can improve it.
https://gist.github.com/jsit/98524a8ba4a97b9fd8db
Cross-posted here:
https://www.ads-software.com/support/topic/events-manager-not-totally-compatible-with-wp-all-import
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WP All Import not totally compatible with Events Manager’ is closed to new replies.