I’ve seen one other request for a Default Value for Image types but it was because they needed it for a new type they were adding.
I’m requesting this feature in general. I don’t see why an Image is any different than other field types in that there can be a default when a new Post is created. Perhaps a default would not be possible when choosing to use an Image Object. But for Image ID and Image URL, there should be a default option so that I can enter the ID or URL of a previous uploaded image.
For instance, if I make an ACF for a banner image, it would be nice to be able to upload a banner image meant for a default banner, and then use its attachment ID as the default for my field. This makes it so then when a user creates a new post, the default banner is already visible to them and gives them a better idea about if they want to change it or not. It also gives them the option to remove it and have no banner image.
If I were to just use the template code to show a default image when no image is selected, it eliminates the option of not showing an image.
Thanks.
Hi @jboyjw,
Thanks for the feature request.
The issue has been submitted to Elliot and hopefully this will be added to the plugin’s development roadmap.
Thanks James. I’ve had a few instances now where this would have been really helpful. Hopefully it gets added to the roadmap.
Cheers.
I came across this while I was looking for something else. Adding a default image setting for all image fields is actually simple to do and a while back I created a filter to do it https://github.com/Hube2/acf-filters-and-functions/blob/master/default-image-for-image-field.php
2 years later – still helping people out 🙂 Thanks John for the link, works perfectly.
This snippet is important if you want to utilize the default image value in the front end.
add_filter('acf/load_value/type=image', 'reset_default_image', 10, 3);
function reset_default_image($value, $post_id, $field) {
if (!$value) {
$value = $field['default_value'];
}
return $value;
}