Skip to main content

Restoring a Website Backup

Instructions for restoring a WordPress site or just the database from a backup via the command line (SSH) in the Seravo environment.

As a Seravo customer, you can always contact our customer service ([email protected]) if you need your site to be restored from a backup. Restoring a website from a backup is included in the service price and comes at no extra cost to you.

However, if you wish to perform the restoration yourself, you can do so via the command line (SSH) using this guide.

Note: If your site has an active online store, you must be extremely careful when restoring the database. Any orders and customer data received between the backup time and the present moment will be lost during a database restoration. Do not perform a database restoration on a live store unless you are absolutely sure of what you are doing.

Preparations Before Starting

All restoration procedures require an SSH connection. (See guide: How do I Connect to My WordPress Site with SSH/SFTP?)

  1. Take a fresh backup: Before making any changes, take a backup of the current state just in case by using the command:

    wp-backup
  2. Check for changes (optional): You can investigate what has changed on the site compared to the backups by using the command:

    wp-backup-list-changes

    You can close this list view by pressing q on your keyboard.

  3. Find the ID of the desired backup: You can get a list of all available backups and their ID numbers by using the command:

    wp-backup-status

    Look at the left side of the list to find the ID number (e.g., 2) of the backup you want to restore.

Option 1: Restoring the Entire Site at Once (wp-content + database)

Use this option if you want to restore both the site files and the database exactly to the state they were in at the time of the backup.

  1. Run the restoration command with your desired ID number (in this example, 2) and the --in-place flag:

    wp-backup-restore 2 --in-place
  2. The command will ask for confirmation. If you are sure, type y and press Enter.

  3. Wait for the restoration to complete. On large sites and databases, this process may take longer.

  4. When Success is displayed on the screen, finally clear the cache using the command:

    wp-purge-cache

Option 2: Restoring the Database Only

If there are no issues with the site files, but for example, a plugin update or a change broke the database, you can restore just the database without touching the files in the wp-content folder.

  1. Run the restoration command with your desired ID number without the --in-place flag. This will safely extract the backup into a temporary folder:

    wp-backup-restore 2
  2. The command will display the path where the files were extracted (e.g., /tmp/backup-restore-2/).

  3. Restore just the database by running the wp-db-load command suggested at the end of the output (make sure the filename matches your actual site):

    wp-db-load /tmp/backup-restore-2/db/example_a12345.sql
  4. After the database import, clear the cache as well:

    wp-purge-cache

Option 3: Restoring Specific File Content Only (e.g., wp-content, themes, or plugins)

If you only want to restore files (such as a broken theme or plugin folder) without affecting the database, proceed as follows:

  1. Extract the desired backup into a temporary directory:

    wp-backup-restore 2
  2. Navigate to the path indicated by the command /tmp/backup-restore-2/wordpress/htdocs/wp-content/, where you will find the files from that specific backup time.

  3. To replace the entire current wp-content directory, run the following commands one by one:

    First, rename your current folder to keep it as a temporary backup:

    mv /data/wordpress/htdocs/wp-content /data/wordpress/htdocs/wp-content-broken

    Next, move the healthy wp-content folder from the backup in its place:

    mv /tmp/backup-restore-2/wordpress/htdocs/wp-content /data/wordpress/htdocs/
  4. Test your site's functionality. If everything is working correctly, you can delete the broken folder to free up space:

    rm -rf /data/wordpress/htdocs/wp-content-broken

    The same logic can also be applied to individual folders, such as /wp-content/plugins/ or /wp-content/themes/.

Restoring to a Staging Environment (Staging)

If you do not want to perform the restoration directly on the public live site, it is often safer to test the situation in a staging environment. From there, you can, for example, retrieve only the missing data or test a fix.

Read more in our separate guide: Restore Site from a Backup into Shadow.

Did this answer your question?