Skip to main content
6 events
when toggle format what by license comment
Jun 2, 2020 at 20:58 comment added cogdog This definitely worked for me using suggestion by @DonWilson just do not forget to include the 3 media libraries if using on front end form (otherwise media_sideload_image is not found). I needed to copy featured images from one site to a separate multisite via switch_to_blog()
Mar 2, 2018 at 22:49 comment added Don Wilson As of WordPress 4.8 you can set the fourth parameter in media_sideload_image to 'id' and it'll return the new attachment id. Eg: $new_att_id = media_sideload_image($image, $post_id, "image description...", 'id'); if(!is_wp_error($new_att_id)) { set_post_thumbnail($post_id, $new_att_id); }
Jun 28, 2016 at 11:51 comment added er.irfankhan11 Where I can add this code ?
May 2, 2015 at 20:16 comment added Omar Tariq This solution works like a charm (y)
Aug 29, 2013 at 19:39 history edited GhostToast CC BY-SA 3.0
deleted 1 characters in body
Aug 29, 2013 at 19:33 history answered GhostToast CC BY-SA 3.0