Support

Account

Home Forums General Issues Conditionally set image field

Helping

Conditionally set image field

  • Hi, I’d like to set a default image field for a field group conditionally on the value of another field in the group. We have a list of map markers as images that we pull into a map and want to dynamically change the marker depending on an ACF field. I don’t think this can be done on the front-end via the conditional part of the field, and I can’t see a way to set the default image? Does anyone know how I’d do this in the ACF interface or would it need code?

    Thanks,

    David

  • You can set the default value of an image field using an acf/prepare_field filter.

    
    $field['default_value'] = $attachment_id;
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.