---
name: wordpress-pre-update-backup
description: Use when asked to back up a WordPress site connected via Cowboy MCP before updating a plugin, theme, or core — takes a database checkpoint, verifies it exists, updates one item at a time, re-checks health after each, and states honestly what a checkpoint does not cover.
---

# Back up a WordPress site before an update

Take a verified database checkpoint before any update, then update one item at a time and confirm the site still works after each. Be honest about the checkpoint's scope: it captures the database, not files.

## Before you start

1. Confirm safe mode is on: call `wp_site_info`.
2. Tell the owner what a checkpoint does and does not cover: it is a snapshot of the database tables. It does **not** back up uploads, images, or plugin/theme code files. If they need those protected, they must take a separate file backup (host snapshot or a backup plugin) before continuing.

## Steps

1. **Create the checkpoint.** Call `wp_create_checkpoint` with a descriptive label (for example, the plugin and version you are about to update).
2. **Verify it exists.** Call `wp_list_checkpoints` and confirm the new checkpoint's id, label, and non-zero size appear in the list. Do not proceed until you have seen it.
3. **Baseline health.** Call `wp_site_health` and `wp_get_php_error_log` (both read-only) and record the result so you can compare afterward.
4. **Update ONE item.** Call `wp_update_plugin` (or `wp_update_theme`) with `dry_run: true` for a single slug to see the resolved plan, then call it again to apply. Cowboy MCP takes its own file backup and checkpoint before the update, runs a post-update health check, and auto-restores the previous version if the site breaks. For a core update, use `wp_cli` with `core update`.
5. **Re-check after each update.** Call `wp_site_health` and `wp_get_php_error_log` again and compare to the baseline. If something broke and the auto-restore did not catch it, undo the single change with `wp_undo_change`, or restore the whole database with `wp_restore_checkpoint`.
6. **Repeat.** Move to the next item and update it the same way — one at a time, never in bulk.

## Notes

- Cowboy MCP already auto-checkpoints before plugin and theme updates (and before mutating WP-CLI) when that setting is on. Taking your own labelled checkpoint first still helps: it gives a clean, named restore point for the whole session.
- `wp_restore_checkpoint` restores database tables only. It cannot bring back deleted uploads or reverted code files — that is why the file-backup caveat above matters.

## Report format

Summarize back to the site owner:
- The checkpoint id and label, and the reminder that it covers the database only, not files.
- Each item updated, with before and after versions and the health comparison.
- Anything that was auto-restored, and any errors that appeared in the log.
- How to roll back: `wp_undo_change` for a single update, `wp_restore_checkpoint` for everything since the checkpoint (which also discards non-MCP changes made after it, such as new orders or comments).
