Programmatically get images by URL and save in uploads folder
There’s actually a great function that will do all three of those things for you: media_sideload_image( $url, $post_id, $description ); The first argument is the remote url of the image you want to download. The second argument is the post id of the post to which you want to attach the image. The third argument … Read more