We are currently on vacation until 21st July 2025, ticket responses maybe be longer than normal during this period, sorry for any inconvenience.

How to know when import process is complete

Closed

Import WP Pro Updated 1 year ago 2 Replies

Laurent asked 1 year ago on April 19, 2024 at 6:22 am

Hello,

I would need to trigger (independant of Import WP) a process once Import WP tasks are over (once an import is fully done).
What is the Import WP technical event, or identifier, on which I can this ?
If a function is needed, what could it be ?

I need that to avoid that my other process is triggered on “unstable” newly added posts.

Thanks a lot,
L

J

James replied Support Agent

1 year ago on April 19, 2024 at 8:01 am

You can trigger an event when an import is complete:

add_action('iwp/register_events', function ($event_handler) {

    $event_handler->listen('importer_manager.import_shutdown', function ($importer_model) {
        $state = \ImportWP\Common\Importer\State\ImporterState::get_state($importer_model->getId());
        if ($state['status'] != 'complete') {
            return;    
        }

        // TODO: trigger code when the import has finished.
    });
});
LC

Laurent replied

1 year ago on April 19, 2024 at 9:25 am

Great, thank you James !