benecaster_powerpress_import_after
Fires after Benecaster’s episode import has processed every published PowerPress episode post for a show. Benecaster detects PowerPress episodes on the same WordPress site by itself, with nothing to configure, and the import runs in the background whether it was started from the setup wizard’s import step or from Benecaster → Settings → Tools → Import Episodes.
The $imported and $skipped counts summarise the PowerPress part of the run. Use to trigger post-import notifications, initiate an external sync, or log import results.
A PowerPress episode is a published post carrying WordPress’s own enclosure post meta, which is where PowerPress keeps an episode on its main podcast feed. Posts are read only while PowerPress is active, because WordPress writes the same meta on any post that links to an audio or video file. Episodes that are only in a PowerPress channel are not imported, so they never count towards $imported or $skipped.
This hook fires whether or not any new episodes were created — guard with if ( $imported === 0 ) return; to skip unnecessary work on re-runs.
On a site with both SSP and PowerPress episodes, one import imports both, SSP first: every benecaster_ssp_episode_imported, then benecaster_ssp_import_after, then every benecaster_powerpress_episode_imported, then this hook. Both import screens start that kind of import. $imported and $skipped count PowerPress posts only, not the whole job’s total.
The import spans several WP-Cron runs. This hook fires once per source, from the run that ends the pass, with that pass’s counts across runs.
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 because they were already imported |
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 the PowerPress post they came from and increment $skipped rather than creating duplicates.
Need this built rather than just documented? See our services →