How does the WXR file differ from the WPDB?

There’s not a one-to-one relationship between the WordPress database and the .wxr file.

We can find this line in the exported .wxr file:

<!-- This file is not intended to serve as a complete backup of your site. -->

Skimming through the export_wp() function, we can see what’s excluded, for example:

  • The data stored in the wp_options table isn’t included, so we would loose the widgets, among other things in there. Only few rows from this table are included, like the site’s title, url, language and description and if a given post is sticky.

  • The data for the user meta in the wp_usermeta table is also missing.

  • Some plugins create extra database tables that are not included.

  • Auto draft posts are not included.

  • It looks like some database fields might not be preserved in the restoring process, like the term_taxonomy_id field.

  • … probably some more data that I missed.

One could try to add the missing data to the .wxr file, through the rss2_head action, but then we would have to modify the import part accordingly. You might need to dig further on that, so in the meanwhile I would stick to the .sql dumps for restoring full backups.