Hello Nick,
I have been doing research on this. The wp_insert_post() function does not call the appropriate hooks. The good news is you’re 95% there. The wp_insert_post function returns the post_id. If you also know the media URL, you can add the record for the “enclosure” (this is what PowerPress uses for the podcast information in the database) a few lines further. The enclosure value is a WordPress field for the enclosure that has 3 lines of information, the media URL, file size in bytes and the content type in that order.
$post_id = wp_insert_post($data);
if( $post_id > 0 ) {
$enclosure_value = ”;
$enclosure_value = $media_url;
$enclosure_value .= “\n”;
$enclosure_value .= filesize($media_url);
$enclosure_value .= “\n”;
$enclosure_value .= ‘audio/mpeg’;
update_post_meta( $post_id, ‘enclosure’, $enclosure_value );
}
I got this code from the PowerPress Posts from MySQL plugin: https://www.ads-software.com/plugins/powerpress-posts-from-mysql/ Look at line 153 to see example of doing wp_insert_post and 193 for the meta data enclosure in file includes/class.podcast.php link: https://plugins.svn.www.ads-software.com/powerpress-posts-from-mysql/trunk/includes/class.podcast.php
Thanks,
Angelo