Support

Account

Home Forums ACF PRO Only allow specific image to be selected from the media library Reply To: Only allow specific image to be selected from the media library

  • Create a dynamically populated radio field. For choices return an array

    
    // build list of images to allow
    // $images contains a list of image IDs
    foreach ($images as $image_id) {
        $image = wp_get_attachment_image_src($image_id, $size);
        $image_tag = '<img src="'.$image[0].'"' width="'.$image[1].'" height="'.$image[2].'"';
        $choices[$image_id] = $image_tag;
    }
    return $choices
    

    for more information see http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/ this can also be done with radio or checkbox fields.