Avoid WordPress Export

WordPress comes with a built-in Export feature that saves some or all posts and related metadata to an XML file, supposedly as a backup or for transfer to another WordPress installation. Unfortunately this feature has two glaring flaws.

  1. Export scrambles HTML markup! I’m using the raw HTML editor to write my posts, so I know exactly what the markup looks like and how it is stored in the database. Export would frequently and randomly insert blank lines between paragraphs or entirely remove <p> tags. I don’t know if these, or potentially other, errors are serious enough to prevent re-import but I would rather not find out.
  2. Exported XML files easily grow to several megabytes for long-running blogs like this one. This can be a problem during re-import, as TJ Kelly describes. Shared hosting services may run PHP under time and memory limits that are exceeded when importing an entire blog. The only direct solution is to manually split the Export file into smaller chunks.

Far better to avoid WordPress Export entirely and simply back up and restore your database directly. You can do this from your server’s database control panel, or use some plugin that has an export/import feature for databases, for example Search & Replace. Warning: I have not tried its database import feature, but export seems to work fine.

On a related note, what I actually used Search & Replace for was to change all internal links on my block from HTTP to HTTPS, and I have a tip for that too: don’t use “Replace Domain URL” unless you’re moving to another server. It expects you to do a re-import of the edited database and therefore exports it rather than saving changes directly. When staying on the same server, just use the regular “Search & Replace” tab which also gives you a handy preview.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.