Announcing Duplicator WP-CLI Commands (And How They Speed Up Backups)
Announcing Duplicator WP-CLI Commands (And How They Speed Up Backups)
What if backing up your website could be as simple as running a single command?
Our latest Duplicator Pro update makes backups easier than ever before. We’ve added WP-CLI commands and new predefined constants!
Whether you’re managing one site or multiple websites, these new features allow you to better protect your digital assets.
From command-line tools to enhanced security features, this update is packed with functionality that will save you time and reduce complexity.
Ready to see what’s in Duplicator 4.5.20? Let’s dive in!
At Duplicator, we added WP-CLI commands so you can manage your backups from the command line. This gives developers and site administrators better control and efficiency.
WP-CLI is a tool for managing WordPress sites directly from the command line. Our latest update introduces specialized commands that make backups faster and more flexible.
Key Duplicator WP-CLI commands:
wp duplicator build
: Create a complete site backupwp duplicator cleanup
: Remove backup files and temporary datawp duplicator info
: Quickly test and verify backup configurationsThe new commands aren’t just simple. They’re incredibly powerful.
Want to save backups in a specific directory? Need to use a particular backup template? You can use WP-CLI instead of your WordPress dashboard.
Here are some ways to customize commands:
--template=<ID>
: Use a predefined backup template--dir=<path>
: Change backup location--delete
: Automatically remove backup after creation--phpsqldump
, --phpzip
, and --duparchive
: Change the archive engineUse the wp duplicator build -- help
command to get an overview of how to customize Duplicator’s WP-CLI to work for you.
If you’re a developer, this new feature will save you a lot of time. You could script batch backups across multiple local sites in minutes.
For example, use this bash script to back up multiple sites simultaneously:
#!/bin/bash
# Define site path to user associations
declare -A site_configs=(
["/var/www/site1/public"]="user1"
["/var/www/site1/public"]="user2"
["/var/www/site1/public"]="user3"
# Add more associations as needed
)
target_path="/path/to/backup/destination"
# Create and clean the destination folder
mkdir -p "$target_path" || { echo "Unable to create folder $target_path"; exit 1; }
cd "$target_path" || { echo "Unable to access folder $target_path"; exit 1; }
# Iterate through site path to user associations
for site_path in "${!site_configs[@]}"; do
user="${site_configs[$site_path]}"
# Check if the web folder exists
if [ ! -d "$site_path" ]; then
echo "Folder $site_path does not exist. Skipping..."
continue
fi
# Execute backup
cd "$site_path" || { echo "Unable to access $site_path"; continue; }
echo "Creating backup for $site_path with user $user"
sudo -u "$user" wp duplicator build --delete --dir="$target_path"
done
# Change ownership and create zip
cd "$target_path" || { echo "Unable to access $target_path"; exit 1; }
chown $USER:$USER *
zip ../backups.zip *
Duplicator will back up all your local sites at once, streamlining your workflow.
The best part about Duplicator’s WP-CLI is its flexibility. You can customize it to meet your unique needs without leaving the command line!
To start experimenting with Duplicator commands, be sure to install WP-CLI.
Imagine having a master key that lets you control who can do what with Duplicator. Our new predefined constants are exactly that — a powerful way to lock down or open up plugin capabilities.
For agencies and website managers, control is everything. You might want to prevent a client from accidentally overwriting their entire site or restrict access to certain backup features.
These new predefined constants give you that granular control.
Instead of manually adjusting access settings for each user, you can now hardcode specific restrictions. It’s like creating a barrier that prevents unauthorized access to critical site functions.
Key Constants to Control Access:
DUPLICATOR_DISABLE_CAP_IMPORT
: Blocks backup importsDUPLICATOR_DISABLE_CAP_EXPORT
: Prevents backup downloadsDUPLICATOR_DISABLE_CAP_BACKUP_RESTORE
: Removes restore functionalityDUPLICATOR_DISABLE_CAP_SCHEDULE
: Disables backup schedulingDUPLICATOR_DISABLE_CAP_STORAGE
: Removes access to backup storage optionsIf you manage a web agency, you might want to prevent a client from importing backups. It’s as simple as adding one line to your wp-config.php file:
define('DUPLICATOR_DISABLE_CAP_IMPORT', true);
With these constants, you’ll create a locked-down environment where only you control sensitive backup and migration processes.
You can:
The DUPLICATOR_DISABLE_CAP_BASIC
constant is your nuclear option. It removes Duplicator functionality from the dashboard entirely, while keeping the plugin technically active.
Backups aren’t just about protecting data – they give you the freedom to innovate without worry.
All of these new features were designed to make your day-to-day site management tasks easier. From lightning-fast WP-CLI backups to advanced access controls, we’ve built Duplicator to adapt to your unique workflow.
These new features are available immediately! Be sure to update to the latest version of Duplicator Pro and start protecting your sites with unprecedented control and flexibility.
Are you using Duplicator Lite? Upgrade to Duplicator Pro to get WP-CLI commands, advanced permissions, and other productivity features.
Questions? Our support team is always ready to help you get the most out of Duplicator.
Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.