Skip to main content

benecaster_powerpress_import_after

Action Free migration-wizard Since v1.0.0

Fires after all PowerPress posts have been processed for a show. The `$imported` and `$skipped` counts give a full summary of the run. Use to trigger post-import notifications, initiate an external sync, or log import results.

This hook fires whether or not any new episodes were created — guard with `if ( $imported === 0 ) return;` to skip unnecessary work on re-runs. When both SSP and PowerPress content are imported in the same job, this hook fires after [benecaster_ssp_import_after](/hooks/benecaster_ssp_import_after/).

Parameters

Name Type Default Description
$show_id int ID of the show
$imported int Number of episodes successfully imported
$skipped int Number of PowerPress posts skipped

Examples

Send Slack notification when new drafts are created

add_action( 'benecaster_powerpress_import_after', function ( int $show_id, int $imported, int $skipped ): void {
    if ( $imported === 0 ) {
        return;
    }

    $message = sprintf(
        'PowerPress import for show %d complete — %d new drafts created, %d skipped.',
        $show_id,
        $imported,
        $skipped
    );

    wp_remote_post( MY_SLACK_WEBHOOK_URL, [
        'body'    => wp_json_encode( [ 'text' => $message ] ),
        'headers' => [ 'Content-Type' => 'application/json' ],
    ] );
}, 10, 3 );

Notes

Imports are safe to re-run. Episodes already imported in a previous run are identified by their source GUID and increment $skipped rather than creating duplicates.