• Resolved ludwigkeck

    (@ludwigkeck)


    In doing an Export from a WordPress.com site a XML file is generated (and zipped up). When I Import to a www.remarpro.com site (hosted by InMotion Hosting) using the Tools > Import tool I always get “Failed to import Media …” messages for all media files. Also all media links in posts are to the original WordPress.com site.

    Is this normal? What do I need to do to import the media and to get the links set to the local Media Library files?

    • This topic was modified 8 months, 3 weeks ago by ludwigkeck.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator bcworkz

    (@bcworkz)

    IME import tools are not 100% reliable. To prevent frustration from failures, I prefer to migrate sites manually. Media URLs are generated dynamically, so new links should be correct already. You do need to fix up any old links existing in the DB, such as img tags in post content. These can be fixed through the Better Search and Replace plugin. Search for the old domain/path and replace with the new.

    If the media import was the only failure, you may just need to download/upload the files via FTP. You might need to search and replace paths, but the importer should have fixed those for you. If all else fails, redo the entire migration manually.

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thank you, bcworkz, for your response. I have tried export – import several times now and “Failed to import Media …” happened every time. The “Migrating WordPress” article was not helpful to me – way over my ability to understand or do. You said that “… import tools are not 100% reliable”. It seems to me that the process is 100% unreliable. I cannot understand how this is allowed in the community. I cannot find simple step-by-step instructions for doing a migration. I exported the Media and now have a 109 MB tar file that I don’t know what to do with. My new site works, but the posts get the media from the .com site. Maybe I just have to live with that.

    Moderator bcworkz

    (@bcworkz)

    If all is working but pulling media from the old site, you might only need to manually upload the contents of the .tar file to your new server. Then use the Better Search and Replace plugin to alter the media URLs in the DB to point to the new media location.

    You can extract the .tar contents to your local computer, then upload to your new server via FTP. Depending on your local computer’s setup, you might need to install an app to access .tar contents. .tar files are much like .zip, only a different kind of compression is used. Be sure the same folder structure in /uploads/ is maintained.

    Then search and replace any old domain names in the DB and replace with the new one. You can do a “dry run” first to help ensure the search and replace operation is doing what you expect it to do before any actual changes are made.

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thank you, bcworkz,

    I extracted the tar file and got the file structure and media. I constructed the same file structure in the wp-content/uploads folder and uploaded the media. Alas, the Media in the WordPress dashboard does not show these files. So, this did not work for me.

    The Import tool would be a very fine and useful way to do this. If it worked as I assume it should. Why did it fail for me? Could it be fixed so it works properly?

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Using the Better Search Replace plugin, I replaced the first part of the image URLs (https://comprules.wordpress.com/wp-content/uploads) with the appropriate part of the new URLs (https://cafeludwig.blog/wp-content/uploads). The posts work with these changes and show the correct images (I did not check all posts, just a sample). However, the images do not show in the Media Library and do not show when editing an old post. Site visitors see the correct images from the new site, but the data base does not have the updated information. Is there a way to correct that?

    Moderator bcworkz

    (@bcworkz)

    Are you sure the DB is lacking and the issue is not caused by some other problem like a theme or plugin conflict? You can look at what data does exist for media through the phpMyAdmin app, usually accessed through your hosting account. In the app, navigate to your WP DB and select the wp_posts table (the ‘wp_’ part might vary). Open the search tab for that table and search for all posts where post_type = attachment. Examine one of the records found and see if you can discern what’s wrong with it.

    Make note of a record’s ID because there’s more related data to check in the wp_postmeta table. Navigate to that table and search for meta data with that ID. If the filename is correct there, the remainder is likely unimportant in solving the issue. The rest is mainly size information for that image.

    If you find lots of attachments and their data seems correct, the problem is more likely a theme or plugin conflict. If you have no attachment posts or many seem to be missing, you could export/import only the media (attachment) posts. If you have trouble with the import plugin in doing so, it’s possible to do this manually through phpMyAdmin. This manual approach isn’t too difficult, but it is more involved than just point and click. There is risk of damaging the current DB, so I strongly advise making a full backup of what you have now before trying to repair anything regarding the DB.

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thank you again, bcworkz,

    You have been kind in trying to give me a hand, but my skills are old, as am I, and can’t handle today’s problems. As you suggested, I did go to phpMyAdmin. Had a fun time trying to figure out which database is the one for the website with this problem. But then didn’t get much farther. You asked “see if you can discern what’s wrong with it“. Here is one place where I can’t tell wrong from right.

    As to plugins, I have Jetpack, the importer, the search plugin, and Options for Twenty Twenty-One, and that is the theme. None of those should interfere with the Import tool working. By the way, I ran the importer once again and it again failed for every image, but it saw that the posts were there and apparently skipped over them. It is that tool that has a problem. When it fails to migrate over a media file it clearly stated that it has failed, it shows the proper file name, what it doesn’t do is tell what went wrong. Back in my early days as a programmer a user grabbed me and implored, “don’t tell me that something went wrong, tell me what I need to do”. I tried to follow that admonition and had a pretty successful career. Now I would really like the caretakers of the Import tool to assist and do likewise.

    That tool, operating as it seems to be intended, would be a great asset. It is probably worth updating and correcting. I would gladly assist as a tester. In the meantime, please forgive me for going out and making fun of this problem.

    Moderator bcworkz

    (@bcworkz)

    I assume you are using the official WP Importer plugin that’s linked to from the Tools admin menu? You could try posting a new topic in its dedicated support forum where those with better knowledge of its use might be able to help you.

    To better get the attention of the Importer developers you could raise an issue in the plugin’s GitHub repository. Free membership is required to raise issues. Please do a search first to see if a similar issue has already been raised. If so, it may be better to add a comment to the existing issue.

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thank you, bcworkz, for pointing me to the dedicated forum. I was not aware of it. I read a number of posts there. I downloaded the importer code and went through it and found some of the difficulties. With that I was able to come up with an approach and solved my problem.

    A while back I had raised some concerns and requested some changes in another area at GitHub (I have been a member for years). That did not go well. The goal there is to close out issues, not to solve them. Requesting improving the importer and making it more user friendly is not likely to succeed.

    This issue should now be considered resolved.

    Thank you again, bcworkz, your help was valuable, I appreciate your patience with me.

    Moderator bcworkz

    (@bcworkz)

    You’re very welcome. I’m pleased you found a resolution. FWIW you hardly required any patience at all ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Tools – Import – Failed to import Media’ is closed to new replies.