wordpress image upload programmatically to custom field
<p>I am going to implement a plugin where it is possible to upload (two) images for anonymous-user (from the fronted). Thereby, thumbnail of the images should also be shown. Therefore, I created a custom post type with two custom (image-)fields. </p>

<p>Now I would like to implement the upload for the images. I already did some research and thereby, I found the wordpress function "wp_insert_attachment" to save files. But - how is it now possible to save the images to the custom fields (with thumbnail when uploading these images)? </p>

<p>Could anyone help me?</p>

<p>Thank you!</p>