Skip to main content

benecaster_ssp_import_post_data

Filter Free

Filters the wp_insert_post() argument array before each SSP draft episode is inserted. Use to override or supplement the post title, status, content, or date before the record is created. Runs for SSP posts only — a PowerPress import never fires it.

This filter covers only the WordPress post record — the post_type, post_status, post_title, post_content, post_parent, post_date, and post_date_gmt keys. All episode meta fields (audio URL, duration, artwork, and so on) are written separately after insertion and cannot be changed via this filter. To act on the newly created episode after all meta is set, use benecaster_ssp_episode_imported instead. The $ssp_post parameter provides full access to the original SSP post and its meta — read any SSP-specific field with get_post_meta( $ssp_post->ID, 'key', true ).

$post_data['post_title'] starts from the SSP episode’s iTunes Episode Title (itunes_title meta) when it has one, and from the post title otherwise, so it can differ from $ssp_post->post_title even with no prefix set. The setup wizard’s optional Strip this prefix from episode titles field is already applied by the time this filter runs — your callback sees the stripped title and still has the final say.

post_date and post_date_gmt are the SSP post’s own dates, except on a site whose SSP Source for publish date setting is Recorded date: there they come from the episode’s Date recorded, so the imported dates match the ones SSP’s feed gave listeners.

Parameters

Name Type Default Description
$post_data array — wp_insert_post() data array built from the SSP post
$ssp_post \WP_Post — The original SSP WP_Post being imported
$show_id int — ID of the show

Returns: array

Examples

Preserve original SSP publish date

add_filter( 'benecaster_ssp_import_post_data', function( $post_data, $ssp_post, $show_id ) {
    // Preserve the original SSP publish date rather than using today's date.
    $post_data['post_date']     = $ssp_post->post_date;
    $post_data['post_date_gmt'] = $ssp_post->post_date_gmt;
    return $post_data;
}, 10, 3 );

Notes

Only the WordPress post record is available here. Episode meta (audio URL, duration, artwork, etc.) is written after insertion and cannot be set via this filter. For post-insertion work on the created episode, use benecaster_ssp_episode_imported.

Need this built rather than just documented? See our services →