Duplicator Documentation

Documentation, Reference Materials, and Tutorials for Duplicator

Want it done for you?

Let the Duplicator experts migrate your WordPress site for you — quick, safe, and hassle-free.

Get Migration Help

Using WP-CLI With Duplicator Pro


Want to back up your site, check your storages, or change Duplicator settings without opening the WordPress dashboard? Duplicator Pro, our backup and migration plugin, includes WP-CLI commands that manage backups, settings, storages, schedules, and more straight from the command line.

In this guide, we’ll show you how to use WP-CLI with Duplicator Pro, including the commands for backups, settings, storages, schedules, templates, and more.

Requirements: In order to use WP-CLI commands, you’ll need Duplicator Pro with an active license, on any plan. Duplicator Lite doesn’t include any wp duplicator commands. Commands for features such as Incremental Backups and the Recovery Point only work when your license includes that feature.

Requirements

WP-CLI is the official command-line tool for WordPress. It must be installed on your server, with access to run it from the command line, for example over SSH. Duplicator Pro must be installed and activated. You need to run all commands from the root of your WordPress installation.

Every command also needs an active license. Without one, or with an expired one, the command stops with this message:

Error: The Duplicator WP-CLI commands require an active license. Activate it in Duplicator > Settings > General.

Command Basics

Every command starts with wp duplicator, followed by a group and an action. To see all groups, run:

wp help duplicator

Then add a group name to see its actions and flags, for example wp help duplicator backup.

A few rules apply to most commands:

  • Most commands accept --format=table (default) or --format=json. JSON works best when another script reads the output.
  • With --format=json, backup build and the create commands print the item they created, so a script can read its id.
  • Items such as backups, storages, templates, and schedules are picked by their id. To find an id, run the matching list command.
  • Fields are set with --<field>=<value>. Lists are comma separated, for example --days=mon,thu.
  • The list commands for storages, templates, schedules, and incremental backups filter on any field that isn’t a list, for example --active=true.

Note: WP-CLI commands don’t ask for confirmation. Commands that delete or cancel something run as soon as you press Enter, and they can’t be undone.

Getting Site Info

The info command shows an overview of your site and of Duplicator: versions, server, the last backup, storages, incremental backups, and schedules.

wp duplicator info

The output is a table of fields and values. Here’s part of it, shown without the table borders:

Field                     Value
duplicator.version        5.2.0
wordpress.version         7.1.3
php.version               8.2.35
database.engine           MariaDB
last_backup.id            4
last_backup.status        complete
last_backup.size          3.91MB
storages                  2
incremental.active        false
schedules.count           0

To get the same details as nested JSON, add --format=json.

Managing Backups

The backup group lists, creates, cancels, moves, and deletes backups.

Listing and Checking Backups

The list command shows your most recent backups with their id, name, creation time, status, and size.

wp duplicator backup list

The following flags are available:

  • --limit=<n>
    Number of backups to list. The default is 20 and the maximum is 100.
  • --status=<status>
    Only backups with this status: queued, running, cancelling, cancelled, failed, or complete.
  • --type=<type>
    Type of backups to list: standard (default) or incremental.
  • --format=<format>
    Output format: table (default) or json.

To see the state of one backup, use get with its id. It shows the status, size, a progress message, whether it’s a full backup, exclusions, warnings, and the reason for a failure.

wp duplicator backup get 12

To check whether your site is protected, use protection-status. Your site counts as protected when a recent backup has a finished copy on remote storage. The output also says whether a recovery point is set.

wp duplicator backup protection-status

Creating a Backup

You can create a backup in 2 ways. The build command builds the backup in your terminal and waits until it’s complete. The queue command hands the backup to your site, which builds it in the background, and returns right away.

wp duplicator backup build

The following flags are available for build:

  • --template=<id>
    The template to build with. Leave it out to use the default template.
  • --dir=<path>
    Copy the archive and the installer to this folder after the build. The folder must exist and be writable.
  • --delete
    Delete the backup from Duplicator at the end. With --dir=, the copied files stay in that folder.
  • --phpzip
    Build the archive with ZipArchive instead of shell zip.
  • --duparchive
    Build the archive with DupArchive instead of shell zip.
  • --phpsqldump
    Has no effect. The database is always exported with mysqldump.

When the build finishes, you’ll see output like this:

Success: Building Backup[6] 20261110_examplecom ...
Success: Scan success
Success: Backup 20261110_examplecom Build Completed
Success: Command Backup Build Completed

Note: The build command uses its archive engine and mysqldump for that backup only. Your site’s backup settings aren’t changed. If your server can’t run the chosen engine, Duplicator uses the first engine it can run. The backup is kept in the default local storage.

To queue a backup instead, use queue:

wp duplicator backup queue
  • --scope=<scope>
    Make it a full backup of all (files and database) or database. The template’s exclusions are removed. Leave it out to use the template as it is.
  • --template_id=<id>
    The template to build with. Leave it out to use the default template.
  • --storages=<ids>
    Comma-separated storage ids to keep the backup in. The default is the default local storage.
  • --password=<password>
    Protect the installer with this password. Leave it out to use the template’s security setting.
  • --reason=<text>
    Why the backup is created. Duplicator stores it with the backup.

The command returns the new backup id:

Success: Backup queued with id 7. Check its progress with: wp duplicator backup get 7

Cancelling and Transferring Backups

The cancel command stops a queued or running backup, or its transfer. The partial backup is discarded.

wp duplicator backup cancel 7

The backup stops at the next step of the build. A backup that finishes before then stays complete.

The transfer command copies a complete backup between the default local storage and another storage, in either direction. One of the 2 storages must be the default local storage.

wp duplicator backup transfer 12 --from=1 --to=3
  • --from=<id>
    The storage that holds the backup.
  • --to=<id>
    The storage to copy it to.

To copy a backup between 2 remote storages, transfer it to the default local storage first, then from there to the other storage.

Reading Logs and Install Steps

The log command prints the build log of a backup. You can add --format=json for JSON, or redirect the output to save it to a file:

wp duplicator backup log 12 > backup-12.log

When the log is very long, only its end is printed, with a warning.

The install-guide command explains how to install a backup on another site. It accepts --format=text (default) or --format=json.

wp duplicator backup install-guide

Deleting and Cleaning Up Backups

The delete command deletes a backup and its files on this server. Copies on remote storages are kept.

wp duplicator backup delete 12
Success: Backup 12 deleted. Its copies on remote storages are kept.

The backup set as the recovery point can’t be deleted. To delete it, first set another recovery point, or reset it under Duplicator Pro » Tools » Recovery.

The cleanup command deletes every backup, together with its files in the default local storage, and the temporary build files. It doesn’t run while a backup or an AutoTune session is running.

wp duplicator backup cleanup

The storages-update command contacts each storage and checks that your finished backups are still there. A missing copy is recorded on the backup.

wp duplicator backup storages-update

To then delete the finished backups that have no copy left in any storage, add --delete.

Note: wp duplicator backup delete, wp duplicator backup cleanup, and wp duplicator backup storages-update --delete delete backups without asking for confirmation. The cleanup command removes every backup on this server, not just old ones. This can’t be undone.

Managing Settings

The settings group reads and changes Duplicator settings by key. To see every key with its current value, run:

wp duplicator settings list

The unavailable column shows values a setting can’t take on your server, and why.

To read one setting, use get with its key. The output also includes a short description:

wp duplicator settings get archive_engine

To change settings, use update with one or more --<key>=<value> pairs. Settings you don’t pass keep their value.

wp duplicator settings update --max_build_minutes=120 --trace_log=true
Success: Updated settings: max_build_minutes, trace_log.

The table below shows a few useful keys:

KeyWhat it doesValues
archive_engineEngine that builds the archive.dup_archive, shell_zip, or ziparchive
max_build_minutesMinutes a backup build may run before it’s stopped.A whole number, for example 90
trace_logWhether the Duplicator trace log is written. Turning it on clears the old log.true or false
server_load_reductionHow much the build pauses to reduce the server load.off, low, medium, or high

Tip: A value your server can’t use is refused with the reason. For example, setting archive_engine to shell_zip on a server without the zip binary returns an error and keeps the current engine.

Managing Storages

The storage group lists, edits, tests, and deletes storages.

wp duplicator storage list

The output shows each storage’s id, name, type, location, notes, the number of backups it keeps, and whether it’s the default storage. Here it is without the table borders:

id  name              type              location                                                 notes                                             max_backups  is_default
3   Default           Default Local     /home/example/public_html/wp-content/duplicator-backups  The default location for storage on this server.  20           true
4   Duplicator Cloud  Duplicator Cloud  Manage Backups                                                                                             10           false

The other storage commands work like this:

  • wp duplicator storage get 4
    Shows one storage.
  • wp duplicator storage update 4 --notes="Offsite copies"
    Changes the name, notes, or max_backups of a storage. Some storages, such as the default one, keep a fixed name.
  • wp duplicator storage test 4
    Tests the connection by writing and then deleting a test file on the storage.
  • wp duplicator storage delete 4
    Deletes a storage. The default local storage can’t be deleted.

Note: For security, storage connection settings and credentials can’t be created or changed from WP-CLI. To add or connect a storage, navigate to Duplicator Pro » Storage in your WordPress dashboard.

Note: wp duplicator storage delete runs without confirmation. Lowering max_backups also removes the oldest backups from that storage, remote ones included, the next time retention runs.

Managing Schedules and Templates

The template and schedule groups share the same actions: list, get, create, update, copy, and delete. To see every field a group accepts, run wp help duplicator template or wp help duplicator schedule.

Working With Templates

Template fields include name (required when creating), notes, name_format, scope (all or database), exclude_paths, exclude_exts, exclude_tables, security (none, password, or encrypt), and password.

Create a database-only template:

wp duplicator template create --name="Database Only" --scope=database

Leave log and temporary files out of template 14:

wp duplicator template update 14 --exclude_exts=log,tmp

Copy template 14 under a new name:

wp duplicator template copy 14 --name="Database Only Copy"

Each command confirms what it did, for example Success: Created template 14. The default template can’t be deleted.

Working With Schedules

Schedule fields include name (required when creating), template_id, storage_ids, repeat (hourly, daily, weekly, or monthly), run_every, days, day_of_month, and start_time in 24-hour HH:MM format and your site’s timezone. A new schedule uses the default template and the default local storage unless you pass others, and it starts inactive.

Create a weekly schedule that runs on Sundays at 2:00:

wp duplicator schedule create --name="Weekly Full Backup" --repeat=weekly --days=sun --start_time=02:00

Activate schedule 16:

wp duplicator schedule enable 16
Success: Schedule "Weekly Full Backup" enabled.

The schedule group also has these actions:

  • wp duplicator schedule disable 16
    Stops the schedule until you activate it again.
  • wp duplicator schedule run 16
    Starts a backup from the schedule now and returns the new backup id. As with any backup, retention on its storages may then replace the oldest backups.

A schedule can’t be activated while a backup or an AutoTune session is running. A schedule with a storage that isn’t ready stays inactive, and the inactive_reason field says why.

Note: wp duplicator template delete and wp duplicator schedule delete delete the item without confirmation.

Managing Incremental Backups

The incremental group controls the incremental backup schedule, which backs up the changes on your site to Duplicator Cloud. Duplicator creates this one schedule for you, so it can’t be created or deleted.

wp duplicator incremental list

Then, use the id from that list with the other actions:

  • wp duplicator incremental get 13
    Shows the interval, the number of snapshots kept, whether it’s active, and the next and last run.
  • wp duplicator incremental update 13 --interval_hours=6
    Changes interval_hours (hours between 2 incremental backups) or max_backups (snapshots Duplicator Cloud keeps).
  • wp duplicator incremental enable 13
    Turns incremental backups on.
  • wp duplicator incremental disable 13
    Turns them off. The backups already on Duplicator Cloud are kept.
  • wp duplicator incremental run 13
    Backs up the site changes now. Retention may then remove the oldest snapshots.

Note: Lowering max_backups removes the oldest snapshots the next time retention runs. Changes are refused while another backup is running.

Using AutoTune and Maintenance Tools

The autotune group runs AutoTune, which runs test backups to find the backup settings that work on your server.

  • wp duplicator autotune status
    Shows the current session and its attempts.
  • wp duplicator autotune start
    Starts a session. AutoTune changes your backup settings until a test backup succeeds.
  • wp duplicator autotune abort
    Stops the running session. Its test backup is cancelled at the next step.

The tools group runs the maintenance tasks from Duplicator Pro » Tools:

  • wp duplicator tools clean-temp
    Removes the temporary build files. It’s refused while a backup is running.
  • wp duplicator tools remove-installer-files
    Removes the installer files left after an installation and purges the caches.
  • wp duplicator tools purge-orphans
    Deletes backup files in the default local storage that no backup owns.

Note: wp duplicator tools purge-orphans deletes files without confirmation. This can’t be undone.

Reading the Activity Log

The activity-log group reads Duplicator’s own activity log of backups, scans, and settings changes. This isn’t the separate Activity Log plugin, which has its own WP-CLI commands.

In the Activity Log, changes made from WP-CLI are labeled WP-CLI. With --format=json, each event also includes via and via_client, which show where the change came from.

wp duplicator activity-log list

The following flags are available:

  • --limit=<n>
    Number of events to list. The default is 20 and the maximum is 100.
  • --backup=<id>
    Only the scan and build events of this backup, each followed by its steps.
  • --severity=<severity>
    Only events with this severity: info, warning, or error.
  • --format=<format>
    Output format: table (default) or json.

Show every step of backup 12:

wp duplicator activity-log list --backup=12

Show the last 100 errors:

wp duplicator activity-log list --severity=error --limit=100

Managing the Recovery Point

The recovery group reads and sets your recovery point. That’s the backup the recovery link restores when your site is broken and you can’t reach the WordPress admin area.

wp duplicator recovery get

The output shows whether a recovery point is set, its backup id, and the recovery link in recovery_url.

To set a backup as the recovery point, pass its id to set:

wp duplicator recovery set 12

The backup must be complete, kept on this server, and a full-site backup. Database-only backups and backups with WordPress core folder or table filters are refused. Setting a new recovery point replaces the current one.

Note: The recovery link works like a password. Anyone who has it can start a restore of your site.

Deprecated Commands

The older commands below still work, but they print a warning and point to the new command. We recommend updating your scripts to the new names:

Old commandNew command
wp duplicator buildwp duplicator backup build
wp duplicator cleanupwp duplicator backup cleanup
wp duplicator storagesUpdatewp duplicator backup storages-update
wp duplicator backup createwp duplicator backup queue

For example, the old build command prints this before it runs:

Warning: wp duplicator build is deprecated, use wp duplicator backup build.

FAQs

Below, we’ve addressed some of the most common questions regarding this feature.

Is WP-CLI available in Duplicator Lite?
No. The wp duplicator commands are only available in Duplicator Pro. Duplicator Lite doesn’t add any WP-CLI commands.
Do commands ask for confirmation?
No. Every command runs as soon as you press Enter, including the ones that delete or cancel something. It’s a good idea to check the id before you run a delete command.
Does WP-CLI use the AI sensitive actions setting?
No. The Allow AI assistants to run sensitive actions setting only applies to AI assistants. WP-CLI doesn’t check it, because anyone who can run commands on your server already has full access to the site.
Why does my queued backup stay queued?
The queue command hands the backup to your site, which builds it in the background. If your server blocks those background requests, use wp duplicator backup build instead. It builds the backup in your terminal.
Can I add a new storage from WP-CLI?
No. For security, storages are created and connected in Duplicator Pro » Storage. From WP-CLI, you can change a storage’s name, notes, and the number of backups it keeps.

That’s it! You now know how to manage Duplicator Pro backups, settings, storages, schedules, and more from the command line.

Want to manage Duplicator by chatting instead? Check out our guide on managing Duplicator with your AI assistant.


Was this article helpful?


Related Articles

Don't Let Another Day Pass Unprotected

Every hour without proper WordPress backups puts your site at risk • Every delayed WordPress migration costs you performance and growth

Get Duplicator Now
Duplicator Plugin

Wait! Don't miss your
exclusive deal!

As a customer, you get 60% OFF

Try Duplicator free on your site — see why 1.5M+ WordPress pros trust us. But don't wait — this exclusive 60% discount is only available for a limited time.

or
Get 60% Off Duplicator Pro Now →