Documentation
Forge Pro
Snapshots & Restore

Snapshots & Restore

Forge Pro captures the "before" state automatically so a bad write can be undone.

WriteWhat is capturedRestore with
Database write (wp_db_write)The entire target tablewp_restore_snapshot
File write, delete, move, promoteThe previous content of the pathwp_restore_file
Content block editHandled by WordPress post revisionsThe post's revision history
wp_execute_phpNothingYour own backup
⚠️

Raw PHP has no generic "before" state, which is why wp_execute_php requires you to acknowledge that a real backup is in place. Snapshots are a safety net, not a replacement for backups.

Database Snapshots

  • The AI must name the table it will affect (with prefix, for example wp_options). The whole table is copied first.
  • Tables with more than 5,000 rows are refused, because they cannot be fully snapshotted. Take a manual backup for those.
  • wp_restore_snapshot restores a specific snapshot ID, or the most recent unrestored one if none is given.

File Snapshots

Writes to a live path, deletes, moves, and promoted drafts save the prior content. wp_restore_file reverts one.

Finding Snapshots

From the AI

wp_list_snapshots lists recent file and database snapshot IDs.

From a terminal

wp forge snapshots
wp forge snapshots --limit=25

Confirm Before Restoring

Restoring a table replaces its current contents with the snapshot. Rows written after the snapshot are lost. Review the table with wp_db_read first.