Are you sure your key is right? You can test it with: get_post_custom_keys
$custom_field_keys = get_post_custom_keys($post_id);
foreach ( $custom_field_keys as $key => $value ) {
$valuet = trim($value);
if ( '_' == $valuet{0} )
continue;
$message .= $key . " => " . $value . "<br />";
}
I think it’s having troubles getting post meta because it hasn’t been inserted fully yet.. You could try wp_insert_post_data hook and explore the second argument $postarr
(in the demo link above), I haven’t looked/read, but it should hold your Custom Fields data (if not you could even explore using $_POST
if it exists).
(Also unless you’ve written your own get_attachment_url()
it’s wp_get_attachment_url())