Restore Guide
Restore your WordPress site from a SafeGuard backup — full, selective, or incremental — with automatic rollback and file quarantine.
Overview
SafeGuard's restore engine lets you bring your WordPress site back to a known good state in minutes. Whether you need to recover from a hack, undo a failed plugin update, or roll back a database change, the restore process is designed to be safe, fast, and reversible.
Common scenarios where you would restore:
- Hacked or compromised site — revert to a clean backup taken before the breach
- Failed update — a plugin, theme, or WordPress core update broke your site
- Accidental data loss — deleted content, media, or configuration changes you need to undo
- Testing and experimentation — restore to a known baseline after trying out changes
- Migration issues — roll back a migration that did not go as planned
SafeGuard restores are resumable — if a restore is interrupted by a server timeout or crash, it picks up where it left off on the next run. During the restore, your site is placed in maintenance mode so visitors see a friendly message instead of a broken page.
Before You Restore
Restoring overwrites your current files and/or database with the contents of the backup. Make sure you understand what will be changed before proceeding.
Run through this checklist before starting a restore:
- Backup exists and is accessible — confirm the backup you want to restore from appears in SafeGuard → Backups with a "Completed" status
- Backup integrity — SafeGuard runs an automatic integrity check (ZIP validation) during preflight, but you can verify manually by clicking the backup and checking its details
- Sufficient disk space — the restore requires approximately 2x the backup size plus 1 GB of free space for extraction and temporary files
- No other restore in progress — only one restore can run at a time; SafeGuard enforces this with an exclusive lock
- Incremental chain intact — if restoring from an incremental backup, the parent (full) backup and all intermediate incremental backups must be available
- Note your current state — consider running a quick backup before restoring so you can get back to your current state if needed
SafeGuard runs automated preflight checks before every restore that verify disk space, backup integrity, storage accessibility, and incremental chain completeness. If any check fails, the restore is blocked with a clear error message.
Restoring from the Dashboard
Navigate to the Backups panel
Go to SafeGuard → Backups in your WordPress admin. Find the backup you want to restore from in the list.
Open the restore dialog
Click the Restore button next to the backup. SafeGuard opens a restore dialog showing the backup details — type, date, size, and contents.
Choose restore scope
Select what to restore:
| Scope | What it restores |
|---|---|
| Full | Everything — files, database, plugins, themes, and uploads |
| Database only | Only the WordPress database (posts, options, users, etc.) |
| Files only | Only files — themes, plugins, uploads, and WordPress core files |
For most recovery scenarios, Full is the right choice. Use selective scopes when you know the issue is isolated to either files or the database.
Configure options
Optionally configure these settings:
- Create pre-restore snapshot — takes a full backup of your current site before restoring, so you can roll back if something goes wrong (recommended)
- URL replacement — if the backup was taken on a different domain, enter the old and new URLs to automatically rewrite them in the database
- Dry run — preview what the restore would change without actually modifying anything
Run preflight checks
Click Run Preflight Checks. SafeGuard validates:
- Backup file exists and passes ZIP integrity verification
- Sufficient disk space (2x backup size + 1 GB buffer)
- Storage provider is accessible (for remote backups)
- Incremental chain is complete (for incremental backups)
If all checks pass, the Start Restore button becomes active.
Start the restore
Click Start Restore. SafeGuard enters maintenance mode and begins the 5-step restore process:
- Extract — unpacks the backup archive to a temporary directory
- Restore Files — copies files from the backup to their original locations, quarantining replaced files
- Restore Database — imports SQL statements to restore tables and data
- URL Replacement — rewrites URLs in the database if configured
- Cleanup — removes temporary extraction files and disables maintenance mode
A progress bar tracks each step in real time. You can safely close your browser — the restore continues in the background via Action Scheduler.
Verify the restore
Once the restore completes, SafeGuard displays a summary showing files restored, tables restored, and URL replacements made. Follow the post-restore checklist to confirm everything is working.
Full restore
# Run preflight checks first
wp safeguard restore preflight 42
# Start a full restore (--yes skips the confirmation prompt)
wp safeguard restore run 42 --yesSelective restore
# Restore only the database
wp safeguard restore run 42 --scope=database --yes
# Restore only files (themes, plugins, uploads)
wp safeguard restore run 42 --scope=files --yesDry run
Preview what would be restored and pruned without making changes:
wp safeguard restore run 42 --dry-runPruning options
After restoring files, SafeGuard can prune files that exist on your site but are not in the backup (e.g., malware injected files). Use these flags to control pruning behavior:
# Restore but skip file pruning entirely
wp safeguard restore run 42 --skip-prune --yes
# Force pruning even if the number of files to delete exceeds the safety threshold
wp safeguard restore run 42 --force-prune --yes
# Also prune the uploads directory (dangerous — removes user media not in the backup)
wp safeguard restore run 42 --include-uploads --yesThe --include-uploads flag deletes uploaded media files that are not present in the backup. This is irreversible. It requires the --yes flag as an additional safety measure.
Monitor and manage
# Check restore status while it is running
wp safeguard restore status
# Cancel a restore in progress
wp safeguard restore cancel --yesEmergency restore (no license)
If your license server is unreachable during an emergency, bypass the license check:
wp safeguard restore run 42 --force --yesSelective Restore
Not every situation requires a full restore. SafeGuard lets you restore specific components of your site independently.
Database Only
Restores all WordPress database tables — posts, pages, comments, options, user data, plugin settings, and custom tables. Files on disk are left untouched.
When to use:
- Accidentally deleted posts or pages
- A plugin corrupted your options table
- You need to revert WooCommerce orders or customer data
- Database migration went wrong
In the restore dialog, select Database only as the restore scope.
wp safeguard restore run 42 --scope=database --yesFiles Only
Restores all files — WordPress core, themes, plugins, and uploads — without touching the database. Useful when files were corrupted or modified but your content is intact.
When to use:
- Malware injected files into your WordPress installation
- A theme or plugin update corrupted files
- You accidentally modified core WordPress files
- File permissions were changed and broke your site
In the restore dialog, select Files only as the restore scope.
wp safeguard restore run 42 --scope=files --yesProtected Files
During any file restore, SafeGuard automatically protects critical configuration files that should not be overwritten:
| File | Protection | Why |
|---|---|---|
wp-config.php | Root-level only | Contains database credentials and salts for the current environment |
.htaccess | Root-level only | Server-specific rewrite rules and configurations |
web.config | Root-level only | IIS server configuration |
.env | Everywhere | Environment secrets |
php.ini | Everywhere | PHP configuration |
.user.ini | Everywhere | Per-directory PHP settings |
These files are never overwritten during a restore, even in full restore mode.
Restoring from Incremental Backups
Incremental backups only contain files that changed since the last backup. When you restore from an incremental backup, SafeGuard automatically rebuilds the complete state by chaining together the full (parent) backup and all subsequent incremental backups in order.
How it works:
- SafeGuard identifies the incremental backup's parent (the most recent full backup in the chain)
- It verifies all backups in the chain exist and pass integrity checks
- The full backup is extracted first as the base layer
- Each incremental backup is applied on top, in chronological order
- The final result is a complete point-in-time snapshot of your site
SafeGuard's preflight checks verify the entire incremental chain before starting. If any backup in the chain is missing or corrupted, the restore is blocked with a clear error identifying which backup is the problem.
Example chain:
| Backup | Type | Date | What it contains |
|---|---|---|---|
| #38 | Full | Monday 02:00 | Complete site snapshot |
| #39 | Incremental | Tuesday 02:00 | Files changed on Monday |
| #40 | Incremental | Wednesday 02:00 | Files changed on Tuesday |
| #41 | Incremental | Thursday 02:00 | Files changed on Wednesday |
Restoring from backup #41 (Thursday) automatically applies #38, then #39, #40, and #41 in sequence to reconstruct Thursday's state.
Never delete a full backup that has incremental backups depending on it. SafeGuard warns you if you attempt to delete a backup that is part of an active chain.
File Quarantine
When SafeGuard restores files, it does not simply delete the files it replaces. Instead, replaced files are moved to a quarantine directory at wp-content/safeguard-quarantine/. Each restore creates a timestamped subfolder (e.g., 20260328-140523) containing all the files that were overwritten.
This means you can recover individual files after a restore without needing to do a full rollback.
Quarantine lifecycle
- Created — automatically during every file restore
- Retained — for 7 days after the restore
- Expired — SafeGuard's daily maintenance task automatically deletes quarantine folders older than 7 days
- Manual cleanup — you can delete quarantine folders early from the dashboard or CLI if you need to free disk space
Managing quarantine
Navigate to SafeGuard → Quarantine to see all quarantine folders. Each entry shows:
- The restore date
- Number of quarantined files
- Days until automatic expiry
You can restore individual quarantine folders (puts the files back to their original locations) or delete them to free disk space.
# List all quarantine folders
wp safeguard quarantine list
# Restore files from a specific quarantine folder
wp safeguard quarantine restore 20260328-140523
# Delete a specific quarantine folder
wp safeguard quarantine purge 20260328-140523
# Delete all quarantine folders
wp safeguard quarantine purge --all --yesQuarantine folders are excluded from both backup and pruning operations, so they will never be accidentally deleted during a subsequent restore.
Rollback
If a restore does not go as expected, SafeGuard provides two ways to get back to your pre-restore state.
Pre-restore snapshot (recommended)
When you enable Create pre-restore snapshot before starting a restore, SafeGuard takes a full backup of your current site first. If the restore produces unexpected results, you can restore from this snapshot to return to exactly where you were before.
After a restore completes, the results screen shows a Rollback button if a pre-restore snapshot was created. Click it to start a full restore from the snapshot.
The snapshot backup ID is returned in the restore output. Use it to roll back:
# The restore output shows: "Pre-restore snapshot: #55"
wp safeguard restore run 55 --yesAutomatic error handling
If a restore fails mid-process (due to a file permission error, database issue, or unexpected exception), SafeGuard automatically:
- Stops the restore process
- Disables maintenance mode so your site comes back online
- Logs the error with full details for debugging
- Preserves the quarantine folder so replaced files can be recovered
- Releases the restore lock so you can attempt another restore
Your site will be in a partial state — some files or tables may have been restored while others have not. This is why the pre-restore snapshot is strongly recommended for production sites.
If your site is stuck in maintenance mode after a failed restore, delete the file wp-content/maintenance.php manually via FTP or SSH, or run:
wp safeguard restore cancel --yesPost-Restore Checklist
After a restore completes, verify everything is working:
- Homepage loads — visit your site's homepage and confirm it renders correctly
- Admin dashboard works — log into
wp-adminand check for errors - Plugins are active — go to Plugins and confirm expected plugins are activated
- Theme is correct — check Appearance → Themes to verify the active theme
- Content is intact — spot-check a few posts, pages, and media items
- Forms and interactive features work — test contact forms, search, and other dynamic functionality
- Permalinks work — if you see 404 errors, go to Settings → Permalinks and click Save Changes to flush rewrite rules
- Cron and schedules — verify your SafeGuard backup schedules are still active under SafeGuard → Schedules
- SSL and URLs — if you used URL replacement, confirm all pages load over the correct protocol without mixed-content warnings
- E-commerce — if you run WooCommerce or another shop plugin, place a test order to confirm the checkout flow
If you used URL replacement during the restore, SafeGuard automatically rewrites URLs in the database including serialized data. However, URLs hardcoded in theme files, custom code, or CSS will need to be updated manually.
Troubleshooting
If you continue to have issues, enable debug logging under SafeGuard → Settings → Advanced and check the log at wp-content/safeguard/logs/restore.log for detailed error messages.