Understanding WordPress Backup and Disaster Recovery – Part 2: Explaining The WordPress Filing System and Database

WordPress Logo (Grey XL)We learnt in the last article that WordPress sites are made up of 2 key components: the website files and the website data stored in a MySQL database.

This is pretty straight forward but if this isn’t a familiar concept to you, jump back to part one and learn about how websites and WordPress sites are put together.

So now you know you need to backup a WordPress database, as well as the files.

This ensures you have a complete website snapshot with which you can recover in the event of a disaster.

But these files, what are they, where are they and which ones should you backup?

Explaining the WordPress file system

This part of the article assumes you haven’t done anything funky with renaming your WordPress folders, or using split-urls or anything like that.

Let’s say WordPress is installed in the public HTML root of your website – there are several parts to the collection of files and folders you’ll see there:

  • The wp-admin folder
  • The wp-content folder
  • The wp-includes folder
  • The collection of a about 23 files whose names all start with wp-
  • index.php file
  • .htaccess file

Let’s look at each one in turn…

wp-admin and wp-includes folders

Basically, for simplicity’s sake, the wp-admin and wp-includes folders are the parts the WordPress installation that you’ll probably never need to go near. They’re used to run/load and administer the site.

wp-content folder

The wp-content directory is what you’ll become most familiar with. Within this folder you’ll see at least 3 folders:

  • plugins
  • themes
  • uploads
  • upgrade – may or may not be present on your installation
  • cache – may or may not be present  on your installation

Anytime you install a plugin on your site, it’ll be installed under the plugins folder.

Anytime you install a theme on your site, it’ll be installed under the themes folder.

Anytime you upload anything to your site (e.g. a photo on your posts), it’ll be uploaded (at least temporarily) to the uploads folder.

So basically, your core website customisation and media (such as uploaded photos, videos etc.) are kept in the wp-content folder – this is important to remember.

wp-config.php and the 20-something files that all begin with wp-

These files are all important, but you don’t actually change the contents of any of them except one: wp-config.php

The rest you can consider them in the same way as the wp-admin and wp-includes folders i.e. just part of the WordPress installation.

The wp-config.php stores important configuration details of your WordPress site – most importantly your WordPress database connection details. If you lose this file, then you’re in a bit of trouble because you’ll lose your connection to the database that stores all your site content and setup details.

.htaccess file and index.php

The .htaccess file, while quite important, isn’t critical to the normal operation of a WordPress site… the contents are usually easily regenerated by WordPress itself and/or plugins, wherever applicable.

The index.php isn’t normally modified either, so in a standard WordPress installation this wouldn’t contain anything specific to your site.

The conclusion? What files are important when backing up a WordPress site?

All of them.

If you don’t have all the files of the installation, the site wont work as you’d expect.

Files that are most critical however are :

  • wp-config.php
  • wp-content/uploads

If you can still access and download WordPress installation files, all the plugins, and the theme your site uses, all that remains is your wp-configuration and the media that’s been stored in the uploads folder.

But…

Since a compressed WordPress installation is about 4.3MB, then including all these files in your backups doesn’t add much to the process. It’s always ideal to recover a website with all the versions of the plugins and the WordPress Core that were in place when you took your database backup.

We recommend backing up all files… it makes for a far simpler recovery process.

Where is the WordPress database?

Your web host will have allocated you a database within which your WordPress site stores your content and configuration.

How each web host provisions access to your databases is different, but typically you’ll have a tool called phpMyAdmin.  Look for this in your web hosting control panel, or consult your web host for an equivalent.

With this tool you’ll be able to browse your databases and should be able to confirm the presence and content of your WordPress site database.

If you don’t know the name of your database, refer back to the wp-config.php file in the root of your site.  There’ll be a line within this file called ‘DB_NAME‘ and you should see a database on your web host with that name.

There is no much else to say about the database except that for a complete and working website recovery, you’ll need to backup your whole database.

Conclusions and Part 3

Understanding a little bit more of how WordPress is pieced together, which files do what, and where your WordPress database is, is important.

Better to take the time to dig around your site and you web hosting to become familiar with its inner-working now, while there is no pressure, than try to do all this after disaster strikes.

Trust me… you’ll appreciate the few minutes you’ve spent today digging around.

When it comes to backing up your WordPress site – you want it all. All the files, all the data in the database.  Picking and choosing now will just leave you much more complicated work to do later on.

It’s also worth keeping this in mind as you select WordPress backup options later.

In the next article, I’ll talk about more in depth about how you can actually create a backup of your WordPress site – what sort of tools are available and what pitfalls you will face.

Leave a Reply

x Logo: ShieldPRO
This Site Is Protected By
ShieldPRO