Manual Backups for WordPress

Although version control helps you keep your site’s code and theme files backed up, that still leaves the question of the actual site data. Site data includes the content of your site such as posts, pages, user accounts, images, videos, and comments.

All this data is not part of the site code but is instead stored in the mySQL database that is linked to your WordPress site. So you also need to think about backing up the contents of your database so that, if content is accidentally or maliciously removed from your site, you can restore it.

In this article we’re discussing manual backups but you also have automated backups available.

WordPress Export

WordPress itself provides a simple way of exporting all your site data directly from the Tools menu item.

On the left hand side, under Tools, click Export and you will be shown a simple screen asking you what you want to export. The best option is to choose All content and when you click the blue button named Download Export File WordPress will generate an XML file containing all your site data which will be automatically downloaded by your browser into your downloads folder.

A good practice is then to put this XML file into whatever version control system you’re using. Should you need to restore your site using this XML file, all you need to do is click Import under Tools and follow the instructions on screen to upload and import the contents in this file.

Database Export

If you’re comfortable working directly with the database — usually from a tool like phpMyAdmin — you also have the option of exporting the database content and table structure directly.

The way to do this is to log in to phpMyAdmin and select the database you want to export from the list on the left hand side. Then click the Export tab and choose the tables you want to export (usually its safest to just select all). Then check the Save as file checkbox and click Go.

As before, your browser will download a file but instead of a “.xml” file this time it will be a “.sql” file. Once again its a good idea to keep this file in the version control system you’re using.

If you’re using any of these methods bear in mind that it is up to you to go through the motions of exporting the database contents on a regular schedule and keep them somewhere safe.

This can get tedious which is why automated backups are generally a preferred and safer option.