Skip to main content

benecaster_feed_sync_import_data

Filter Premium migration-wizard Since v1.0.0

Filters the data array built from an RSS item before a draft episode is created during feed sync. Keys match episode post fields and meta keys. Use to transform or augment imported data — for example, to parse a custom RSS namespace and map it to a Benecaster custom field.

Parameters

Name Type Default Description
$data array Episode data array built from the RSS item
$rss_item SimpleXMLElement The RSS item being imported
$show_id int ID of the show

Returns: array

Example

add_filter( 'benecaster_feed_sync_import_data', function( $data, $rss_item, $show_id ) {
    // Pull a custom <myshow:sponsor> RSS element and map it to a Benecaster custom field.
    $ns      = $rss_item->children( 'https://myshow.example.com/rss/1.0' );
    $sponsor = isset( $ns->sponsor ) ? (string) $ns->sponsor : '';
    if ( $sponsor ) {
        $data['meta']['_episode_sponsor'] = sanitize_text_field( $sponsor );
    }
    return $data;
}, 10, 3 );