Copy url from post_content to custom field
What you need to do is run a function that gets triggered when the “update” button is clicked on posts.
I can’t guarantee that my attempt to isolate the shortcode was successful, ( I’m not too good at that stuff ), but you definitely get the idea here!
add_action('save_post', 'save_details');
function save_details() {
global $post;
if(get_post_type($post->ID) == 'your_custom_post_type') {
if(stripos($post->post_content, '[audio:http://') !== false) { // if shortcode exists
$content = $post->post_content;
//first position of shortcode
$p1 = stripos($content, '[audio:http://');
// strip code from before the shortcode.
$content = substr($content, $p1);
//find when end of the shortcode starts
$p2 = stripos($content, '.mp3]');
$p2 = $p2 + 5; // add five to get where it ends.
//get full shortcode
$content = substr($content, 0, $p2);
// save shortcode to meta field
update_post_meta($post->ID, 'custom_field_name', $content);
}
}
}
Let me know if you have any troubles!