Plugin Support
Shawn
(@shawnogordo)
I have forwarded your request to the Blubrry support team.
Hello @nickcraig,
Your php script that automatically generates posts, are you using the WP functions to create a post or are you adding the records to the database directly?
Thanks,
Angelo
Doing it via WP functions like “wp_insert_post($new_post)”. Would be awesome to have this feature for completely automated podcasting.
-Nick
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://ww.wp.xz.cn/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.ww.wp.xz.cn/powerpress-posts-from-mysql/trunk/includes/class.podcast.php
Thanks,
Angelo
Angelo you are the man this works like a charm. Thank you very much!
Hello Nick,
Awesome, glad to hear that worked!
If you end up making your php script into a plugin and post it on ww.wp.xz.cn, please let me know we will link to it in the plugin!
IF you have a moment free, we would greatly appreciate it if you could leave our plugin a review!
Thanks,
Angelo