I'm looking to make it so an administrator can do a complete backup of a WordPress website with the click of a button in the administration pages. In doing so, I figure the code would need to backup /wp-content for its themes, plugins, and uploads directories, as well as do a database backup. But backing up the database could be tedious, especially with privileges issues.

So, why not use WordPress's own WXR file? According to WordPress, the WXR file backs up the following information:

This format, which is called and WordPress eXtended RSS or WXR file, will contain your posts, pages, custom post types, comments, custom fields, categories, tags, custom taxonomies, and users.

How does the WXR file differ from the WPDB? That is, what would I be missing if I don't back up the WPDB and only went with the WXR file? Could I achieve a complete WordPress backup via the manner described above?


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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