I'm trying to add the URL of the post images in to a default custom field. Here is the code I got so far...
Here is how I add the default custom field:
add_action('wp_insert_post', 'mk_set_default_custom_fields');
function mk_set_default_custom_fields($post_id)
{
if ( $_GET['post_type'] != 'post' ) {
add_post_meta($post_id, 'Image', '', true);
}
return true;
}
Now I need a function that fills the value with the URL from the image uploaded. If there is no image uploaded the field can be empty.
Here is the code to fill the value with info, but I need the thumbnail url in the value
add_post_meta($post_id, 'custom field name', 'custom field value', true);