To prevent catastrophic data loss, it would be helpful if WP-CLI magically detected when your command might perform some database operation, and created a snapshot immediately prior.

Proposed Algorithm


  • WP-CLI could inspect the queries going to into $wpdb.
  • As soon as inserts or updates started happening, it would keep a log of them.
  • Maybe there’s a way of reversing the insert queries?