I need to reinstall WP from scratch due to malware.

Can reliably use the built-in Import/Export tool (Tools > Import/Export)?

It appears it only gives me an XML file. What can I do to ensure all media is also available for import?

1 Answer 1


In addition, you can import attachment by checking the "Download and import file attachments" option.


This means, if you use the official WordPress Importer plugin, it will read the media URL from the file, download that file and finally upload it to your new install.

When your old site is offline, eg. taken offline after malware infection, you won't be able to import any media files this way.

If you have backups, you can try to play that in (media related db tables + wp-content/uploads/ folder). But you'll need to take very close looks, as not to back up the previous infection as well.

  • I am instructed by the host to delete everything and reinstall WP from scratch. I guess the import/export tool will not work for me because the source and destination of media files is the same?
    – IMB
    Commented Jul 17, 2017 at 14:05
  • @IMB It will not work, because the files have been deleted. You could delete everything except media wp-content/uploads but then you'll have the risk of not having deleted every infected file.
    – kero
    Commented Jul 17, 2017 at 14:08
  • I see, thanks I understand the risk but basically that is the only choice I have?
    – IMB
    Commented Jul 17, 2017 at 14:13
  • @IMB In the short amount of time I thought about this plus with this little information about the problem: yes.
    – kero
    Commented Jul 17, 2017 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.