Extract Backup

The extract command pulls files and database from a WP Staging backup (.wpstg) without needing a running WordPress installation. This is useful for disaster recovery, site inspection, or preparing files for manual import.

What You’ll Get

After extraction, you’ll have:

  • All WordPress files (core, themes, plugins, uploads)
  • Database SQL file ready for import
  • wp-config.php with original settings

Basic Extraction

Extract all files and database to the default output directory (./wpstaging-output):

wpstaging extract backup.wpstg

Or use the --from flag:

wpstaging extract --from=backup.wpstg

Extract from Remote URL

Extract directly from a remote backup file without downloading it manually first:

wpstaging extract --from=https://example.com/backups/backup.wpstg

Or pass the URL directly as an argument:

wpstaging extract https://example.com/backups/backup.wpstg

What happens:

  • Validates the remote file (size and format)
  • Displays backup information
  • Asks for confirmation before downloading
  • Downloads with progress indicator (supports resume for interrupted downloads)

Extract to Custom Directory

Specify where to extract the files:

wpstaging extract --outputdir=/var/www/restored-site backup.wpstg

Short form:

wpstaging extract -o /var/www/restored-site backup.wpstg

Extract with Database Normalization

WP Staging backups contain placeholders in the database file. Use --normalizedb to replace them with actual values so the SQL file is ready for standard database tools:

wpstaging extract --normalizedb backup.wpstg

This replaces placeholders like:

  • {WPSTG_TMP_PREFIX} โ†’ temporary table prefix
  • {WPSTG_FINAL_PREFIX} โ†’ final table prefix
  • {WPSTG_NULL} โ†’ SQL NULL
  • {WPSTG_BINARY} โ†’ BINARY data type

Replace Site URL and Database Prefix

Extract while changing the site URL and database prefix for a new environment:

wpstaging extract --normalizedb \
  --site-url=https://newdomain.com \
  --db-prefix=wp_new_ \
  backup.wpstg

Note: The --normalizedb flag is required when using --site-url or --db-prefix.

Filter What to Extract

Use --only-* flags to extract specific parts of the backup:

FlagShortDescription
--only-wproot-rExtract only WordPress root files
--only-wpcontent-wExtract only wp-content directory
--only-plugins-iExtract only plugins
--only-themes-tExtract only themes
--only-muplugins-mExtract only must-use plugins
--only-uploads-uExtract only uploads
--only-languages-gExtract only language files
--only-dbfile-bExtract only database file
--only-dropins-eExtract only drop-in files
--only-file-fExtract only files matching this name

Example – Extract only the database file:

wpstaging extract --only-dbfile backup.wpstg

Example – Extract only plugins:

wpstaging extract -i backup.wpstg

Skip Specific Parts

Use --skip-* flags to exclude parts from extraction:

FlagShortDescription
--skip-wproot-RSkip WordPress root files
--skip-wpcontent-WSkip wp-content directory
--skip-plugins-ISkip plugins
--skip-themes-TSkip themes
--skip-muplugins-MSkip must-use plugins
--skip-uploads-USkip uploads
--skip-languages-GSkip language files
--skip-dbfile-BSkip database file
--skip-dropins-ESkip drop-in files
--skip-file-FSkip files matching this name

Example – Extract everything except uploads:

wpstaging extract --skip-uploads backup.wpstg

Example – Skip database and uploads:

wpstaging extract -B -U backup.wpstg

Verify Extracted Files

Verify the integrity of extracted files by comparing checksums with the backup:

wpstaging extract --verify backup.wpstg

Overwrite Behavior

By default, extraction overwrites existing files. To control this:

# Skip overwriting (default is yes)
wpstaging extract --overwrite=no backup.wpstg

All Extract Flags

Flags:
  -o, --outputdir string   Directory for extracted files (default: ./wpstaging-output)
  -n, --normalizedb        Normalize database files during extraction
      --overwrite string   Overwrite existing extraction directory (yes/no) (default "yes")
      --site-url string    Specify a new WordPress site URL
      --verify             Verify integrity of extracted files
      --db-prefix string   Specify a new WordPress database table prefix
      --from string        Backup file path or remote URL (http/https)

Common Use Cases

Disaster Recovery

Extract files from a backup when your WordPress installation is broken:

wpstaging extract --normalizedb --outputdir=/var/www/recovery backup.wpstg

Extract Only Database for Manual Import

Get just the database SQL file:

wpstaging extract --only-dbfile --normalizedb backup.wpstg

Migrate to New Domain

Extract with new site URL for migration:

wpstaging extract --normalizedb \
  --site-url=https://newsite.com \
  --outputdir=/var/www/newsite \
  backup.wpstg

Next Steps

Updated on January 27, 2026