Dear,
I have a custom Post “fotografia” with some field made using ACF, one of this is an Image, it is mandatory.
When I edit the post, the field Image is empty and I have to choose every time the image from the media gallery (where correctly I see only the image uploaded to that post) before save.
I don’t know if matter but I use this function to set the image uploaded as default image of the post, I found the function on the support forum:
function acf_set_featured_image( $value, $post_id, $field ){
if($value != ''){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
update_post_meta($post_id, '_thumbnail_id', $value,true);
}
return $value;
}
add_filter('acf/update_value/name=fotografia', 'acf_set_featured_image', 10, 3);
The Image field is configured to store as ID.
add_filter('acf/update_value/name=fotografia', 'acf_set_featured_image', 10, 3);
The fotografia
should be the name of your ACF image field and it should return the image ID.