• Resolved Jay

    (@topdownjimmy)


    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

    https://www.ads-software.com/plugins/wp-all-import/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    This is great! Thank you for sharing this. We have just released an Add-On API that you might want to check out: https://www.wpallimport.com/documentation/addon-dev/overview/

    You can make an Add-On for WP All Import to make importing data into Events Manager even easier.

    This is something I’ve been trying to figure out — thank you thank you thank you!!

    I tried using the gist code, which is updated to work with the wp all import cron jobs. I’m only testing at this point and haven’t set up cron jobs. This fix doesn’t seem to work when you do manual imports via wp all import all — does that sound right?

    First import, works great and all events end up published. Second time, they return to draft form.

    I’ve also have an issue with the dates appearing blank in the datepicker field, even though they are appearing in the event list. Did you have any issues with this?

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.