When I restore WordPress core, should I include wp-config.php in the restoration?

This question is only relevant if you have the “More Files” add-on (or UpdraftPlus Premium, which includes all add-ons).

If you are restoring a site, and restoring WordPress core as part of that restoration, then you will be asked if you wish to include wp-config.php in your restoration:

Option to restore wp-config.php

Option to restore wp-config.php

What is wp-config.php? It is the WordPress configuration file. You can read about it in the official WordPress documentation, here.

It tells WordPress how to find its database. As such, it is a critical file. It can also contain various other settings that control WordPress’s behaviour, e.g. your language setting if you are not using the default language.

If you are performing a migration (i.e. move to a different URL), rather than a restoration, then it is always wrong to use this option. (If you can think of any exceptions to that rule, then let us know; we can’t!).

Should you include it in your restoration? It is always safe not to – if you do not select this option, then UpdraftPlus will leave wp-config.php alone, but restore the backup as wp-config-frombackup.php. You can then look at the differences (if any) between the two by hand, and tweak them at your leisure.

However, i you are using the same database as was being used when you backed-up, then generally, yes, it is safe. wp-config.php may contain settings placed there by other plugins that you will want to retain. However, if you are using a different database (e.g. this is a new installation, or you had to create a new one for some other reason), then restoring wp-config.php will break your site – because, after restoration, WordPress will be looking in the wrong place for its database.

The rule of thumb is: if in doubt, then don’t; especially if you are not confident about editing wp-config.php yourself if you make a mistake. All you are likely to lose is a few settings which you can easily restore. However, if something does go wrong then don’t panic – editing wp-config.php is actually very easy, and if you’re not confident yourself then you should easily be able to find someone to do it for you.


Posted in: Restoration