don't miss out

sign-up for newsletter to stay in the loop

subscribe to our newsletter

Newsletter
download

How to Backup your WordPress site using WP CLI

All-in-one solution for Backup, Restore and Migration.

How to Backup your WordPress site using WP CLI

Overview

In this guide we will help you on How to Backup your WordPress site using WP CLI. Here you must have Backuply Pro version.

There are certain Backuply functions that can be performed using WP-CLI which are as follows:-

  • List Backups or Backup Locations.
  • Create Backup.
  • Restore Backup.
  • Sync Backups with cloud storage.
  • Stop or Kill Backup or restore.
  • Check backup or restore progress.

Note: You can even get access to this information on the WP-CLI. All you need to do is use the wp help command as shown below.

wp help backuply <command>

wp help backuply list //this will provide info about the list command

List Backups or Backup Locations

The format of list backup command is

wp backuply list <type> [--format=<format>]

Here the type can be either backups or locations

For <format> we have support for 4 formats as listed below.

  • table
  • json
  • yaml
  • count

Command to list Backups

wp backuply list backups

Command to list locations in json format

wp backuply list locations --format=json

Create Backup

The format of create backup command is

wp backuply backup [--location_id=<location_id>]

So if you dont use location_id arg then your backup will be create in Local Storage so the command for that will be.

wp backuply backup

So if you want to backup to remote location you will need the ID for that which you can get from the getting list location command as shown above. For example here we are taking location ID 4.

wp backuply backup --location_id=4

Restore Backup

The format of restore command is

wp backuply restore [--backup_name=<backup_name>]

You can get the backup name from the list command. After choosing a backup the command to restore would be

wp backuply restore --backup_name= wp_127.0.0.1_2022-10-18_13-09-32

Sync Backup with cloud storage

The format of command to sync backup with remote storage is:-

wp backuply sync [--location_id=<location_id>]

So lets say the location id is 4 then the command would be

wp backuply sync --location_id=4

Stop or Kill Process

Using this command you can stop/kill restore or backup process.

The format of command to kill is

wp backuply kill <type>

So here type mean what you want to kill restore or backup. So the command to kill backup process would be.

wp backuply kill backup

Check progress

To check the progress of backup or restore the format of command is

wp backuply progress [--format=<format>]

So here we support 2 formats table and json. Table is the default format.

wp backuply progress --format=json
wp backuply progress //using this commad the response will be in default format

So these were all the commands that Backuply supports for WP-CLI if you have suggestions for other commands do let us know.

If you face any issue feel free to contact our support team. We will be glad to help you out.

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list