Title: Problems with wp_insert_attachment
Last modified: August 20, 2016

---

# Problems with wp_insert_attachment

 *  [spacefolded](https://wordpress.org/support/users/spacefolded/)
 * (@spacefolded)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problems-with-wp_insert_attachment/)
 * I upload some images into upload dir. Then i need to insert them as attachments.
   I use wp_insert_attachment, wp_generate_attachment_metadata, wp_update_attachment_metadata
   for this. As a result i have original images, resized images and db data in wp_posts
   and wp_postmeta. My data in wp_posts is correct, like i did this with default
   downloader. I’m not sure that my data in wp_postsmeta is correct, but i have 
   there some results which have url to the original image and name of resized image.
 * All i need – to print my results with ‘default’ ‘foreach ($attachments as $attachment)’
   and ‘wp_get_attachment_image_src($attachment->ID, ‘medium’)’ for example.

The topic ‘Problems with wp_insert_attachment’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [spacefolded](https://wordpress.org/support/users/spacefolded/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/problems-with-wp_insert_attachment/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
