php – Only the first image uploads
I am trying to upload these two images to my site:
But only the first image works. I am using the following code, where $post_id is the post to attach these images to:
media_sideload_image( 'https://listing-images.homejunction.com/maris/82721628/photo_1.jpg', $post_id, '','id' ); media_sideload_image( 'https://listing-images.homejunction.com/maris/82721628/photo_2.jpg', $post_id, '','id' );
I have tried other methods of uploading and attaching images, but the upload seems to always fail. I can upload photo_1 multiple times, but photo_2 does not work. Either it doesn’t upload at all or it’s a blank image.
How can I get both images uploaded and attached to a post?