Home › Forums › Front-end Issues › How to display default values on front end? › Reply To: How to display default values on front end?
If this default image value, or the field itself, did not exist when you first saved the posts then you can try getting the field value by the field key instead of the field name. The issue if a field did not exist when the post was initially saved is that ACF does not know how to find the field key in order to use the default value.
If that does not work then you need to code it into your template
$value = get_field('your-field-name');
if (!$value) {
$value = ?? set default value
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.