# Update plugins and themes safely

> Update one plugin or theme at a time with a backup, a checkpoint and a check of your key pages after each, and roll back the one that breaks something.

Most breakage on a live site comes from updates. This guide updates one plugin or theme at a time, checks your key pages after each, and rolls back the one that goes wrong. A broken update stays a small, known problem.

## What you need

- **Read-only diagnostics** to see what is waiting and to take the baseline (steps 1 and 2).
- **Backups & restore** for the backup, and **Plugins & themes** for the updates. **Settings & maintenance** clears caches at the end. The Developer preset covers all three.
- On the Free plan your AI app can list the updates and check pages, but you install them yourself in wp-admin.

## Before you start

- Pick a quiet time. If you saved your quiet hours in the [site memory](/docs/concepts/memory/), your AI app plans around them.
- WordPress core and PowerWP AI itself cannot be updated through your AI app. Do those in wp-admin under **Dashboard › Updates**, after the plugins.
- Updates change files, and often database tables too. That is why the plan starts with a backup.

## Steps

:::steps
1. **See what is waiting.** Nothing is installed.
   - Example prompt: `Which plugins and themes have updates? For each one give the version jump, whether it is a major jump, whether it fits my PHP and WordPress versions, and whether it looks critical for checkout, forms or caching. Don't update anything.`
   - Your AI app will use `updates_check` (with a refresh), `plugins_list`, `themes_list` and `site_overview`.
2. **Take a baseline.** The status, load time and headings of your key pages now, so a page that loses content shows up later.
   - Example prompt: `Record the status, the number of H1 headings and the word count of the home page, the shop and one product page. Also tell me about errors from the last hour.`
   - Your AI app will use `page_check` with `summary=true`, `error_log_read`, `site_health` and, on a store, `wc_overview`.
3. **Agree the plan and the order.** Small updates first, major jumps one by one, an add-on never before its base plugin.
   - Example prompt: `Give me the update plan in order. I want to skip the page builder for now. Wait for my OK.`
   - Nothing is installed until you approve.
4. **Back up and set a checkpoint.**
   - Example prompt: `Make a full backup without the uploads folder, download it to my computer, then create a checkpoint called "before plugin updates".`
   - Your AI app will use `backup_create`, `job_status`, `backup_download_links`, `backup_confirm_downloaded` and `checkpoint_create`. Or download the backup yourself in **PowerWP AI › Backups**.
5. **Update one plugin at a time.**
   - Example prompt: `Update the first plugin on the list only, then stop.`
   - Your AI app will use `plugin_manage` with `action=update`. Before it updates, the plugin's folder is saved as a snapshot. If the update causes a fatal error, PowerWP AI reverts it automatically. Other problems show up in the next step.
6. **Check after each update.** Go on only when the result is clean.
   - Example prompt: `Check the same pages as before and the error log for the last ten minutes. Compare with the baseline. If anything is different, say so and stop.`
   - Your AI app will use `page_check` and `error_log_read`.
7. **Finish.**
   - Example prompt: `Clear the caches, check for updates again, run the health tests and look at my key pages one last time. Then summarize what changed.`
   - Your AI app will use `cache_flush`, `updates_check`, `site_health` and `page_check`.
:::

Themes follow the same steps with `theme_manage`. Premium plugins and themes update through their own updater when it is set up, or from a zip file you provide.

## Check the result

- Each plugin goes from its old version to the new one in **PowerWP AI › Changes**, with a change id.
- The key pages return status 200 with about the same headings and word counts as the baseline.
- No new errors appear in the log.
- Your AI app's summary lists each plugin from version to version, the change ids, the checkpoint id and the backup.

## How to undo

- **One update:** ask `Undo change #N` or choose **Roll back** in **PowerWP AI › Changes**. The plugin's folder is restored from the snapshot taken just before the update.
- **Everything in this run:** roll back to the checkpoint. It restores each plugin the run updated.
- **A conflict:** the rollback stops if the plugin was changed again afterwards. Look at the change first, then decide.

A rollback brings back the plugin's files, and nothing else. It cannot undo what the new version already wrote to the database, such as new tables or converted settings, so an older version may not like the data a newer one left behind. If that happens, your backup is the way back. A restore replaces the database or files and cannot be undone, so your AI app does it only when you explicitly ask.

If the plugin's folder is bigger than the snapshot limit (256 MB by default), the update is refused before anything changes. Make the backup first, then ask the site owner to raise **Settings › Safety & rollback › Largest automatic snapshot**.

Snapshots are kept for 30 days by default. After that, an old update can no longer be rolled back.

## Recipes that do this

[before_plugin_updates](/docs/reference/recipes/#before_plugin_updates) follows these steps. [monthly_checkup](/docs/reference/recipes/#monthly_checkup) lists what is outdated without changing anything. If an update breaks the site, [site_recovery](/docs/reference/recipes/#site_recovery) takes over. [diagnose_site](/docs/reference/recipes/#diagnose_site) gives a wider report afterwards.

:::cards
- [Fix a critical error](/docs/guides/fix-critical-error/) — If an update crashes the site.
- [Work safely on a live site](/docs/guides/safe-workflow/) — The routine behind these steps.
- [Backups and restore](/docs/safety/backups/) — What a backup holds.
- [Security check-up](/docs/guides/security-checkup/) — Find outdated and unused plugins.
:::

Source: https://powerwp.ai/docs/guides/safe-updates/
