I’m trying to create plugin importing posts to WordPress. Imported articles (XML) contain “image-name” attribute and this image is already uploaded to the server.
I would like to, however, make WordPress do its “magic” and import the image to the system (create thumbnails, attach it to the post, place it under the wp-uploads directory scheme)… I found function media_handle_upload($file_id, $post_id, $post_data, $overrides) but it requires array $_FILES to be filled with actual upload (and I’m not uploading file – it is already placed on the server) so it’s not very useful
Do you have any hint how to proceed?
Thanks
Check the following script to get the idea. (It does work.)