I want to move someone else’s WordPress blog to a new server. I only have access to the exported XML file of the blog. When importing the XML with the WordPress Importer plugin, everything went fine except for importing the images.
It seems the authors of the blog did not use the built-in upload functionality to add images to a blog post, but uploaded them separately on the server.
I was able to download all the images referenced in the blog posts and store them in the “uploads” folder, so all images display correctly on the new server.
However they don’t appear in the media library and thus I can’t access them in the code of the new theme.
So my question is:
How do I scan all blog posts for image references and add them as attachments?
I’m in the process of developing a media tools plugin. One of the tools is an import as attachment that goes through the content of all your posts, pages or custom post types and imports and attaches the images to the media library. It also changes the url referenced in the content to the new url created by the import.
https://github.com/c3mdigital/media-tools-for-WordPress