惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
Y
Y Combinator Blog
Jina AI
Jina AI
G
Google Developers Blog
Last Week in AI
Last Week in AI
博客园 - 叶小钗
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
The GitHub Blog
The GitHub Blog
D
Docker
量子位
罗磊的独立博客
腾讯CDC

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Pinpoint rollback — building per-plugin revert with WP-CLI
Susumu Takahashi · 2026-06-15 · via DEV Community
Cover image for Pinpoint rollback — building per-plugin revert with WP-CLI

Susumu Takahashi

You batch-update 20 plugins, and one breaks the site. Most WordPress maintenance tools play it safe and roll back all 20 updates (variations on "Safe Updates" or "Atomic Updates"). It's a reasonable default.

But running in production, you start running into cases where you want only the broken one reverted, and the other 19 to keep their updates. Here's how that design is built on top of WP-CLI.

The command that makes it possible — wp plugin install --version=X --force

WP-CLI has a powerful command for "install a plugin at a specific version, overwriting whatever's currently there":

wp plugin install <plugin-slug> --version=1.2.3 --force --skip-plugins --skip-themes

What each flag does:

  • --version=1.2.3 — Specifies the older version to install (any version published on WP.org works)
  • --force — Overwrites if the plugin is already installed
  • --skip-plugins --skip-themes — Skips plugin/theme loading at WP-CLI startup, so WP-CLI itself doesn't crash even when a broken plugin is present (covered in a separate post)

That one line is enough to roll back a single plugin to a known-good version. The remaining design question is when and under what conditions to invoke it.

Combining with HTTP checks

Step-by-step updates with HTTP status checks between each:

Pre-update:    GET / → 200
↓
wp plugin update <plugin-slug> --skip-plugins --skip-themes
↓
Post-update:   GET / → 500   ← broken!
↓
wp plugin install <plugin-slug> --version=<previous> --force --skip-plugins --skip-themes
↓
Post-rollback: GET / → 200   ← recovered
↓
proceed to the next plugin

By switching the update granularity from "everything at once" to "one at a time + HTTP check", you get clear visibility into which plugin caused the breakage.

Identifying the rollback target

The plugin you just updated is the prime suspect — by construction. This isn't possible with bulk updates: if multiple plugins are updated together and HTTP returns 500, you can't tell which one is responsible.

The advantage of one-at-a-time updates is that the moment the HTTP status changes, the plugin updated immediately before becomes the confirmed rollback target. No risk of accidentally reverting an unrelated plugin.

The previous version comes from a pre-update snapshot:

# Capture before updates start
wp plugin list --format=json --skip-plugins --skip-themes > /tmp/plugins_before.json

# Look up the previous version of the failed plugin
prev_version=$(jq -r '.[] | select(.name=="<slug>") | .version' /tmp/plugins_before.json)

That gives you the version string to feed back into wp plugin install --version=<prev>. Roll back, verify, proceed to the next plugin.

Verifying recovery — always re-check HTTP after a rollback

After rolling back, take the HTTP status again:

  • ✅ Back to 200 → skip the update for this plugin, continue to the next
  • ❌ Still 500 → the rollback didn't recover the site (the broken state is in the DB schema or other files, not just the plugin's PHP) → escalate to heavier recovery (full DB rollback, cache flush, theme fallback, etc.)

The lesson: don't assume rolling back the plugin always fixes things. --force overwriting only replaces files; DB-side inconsistencies need separate detection.

Takeaway — "roll back all" vs "roll back one"

The industry-mainstream "roll back everything" design is simpler to implement and errs on the safe side — and there are good reasons it's the default. On the other hand, the "roll back only the one that broke" design has these operational advantages:

  • The culprit is recorded directly in the log
  • Successful updates to other plugins are preserved
  • At the next maintenance run, only the rolled-back plugin needs retrying

A trade-off: more implementation complexity, in exchange for higher operational transparency and continuity.

The small WP-CLI command --version=X --force is what makes this possible. For anyone considering maintenance automation on shared hosts where SSH + WP-CLI is available, this flag combo is worth committing to memory.

For the structural reasons the industry as a whole hasn't adopted per-plugin rollback, see also three gaps the WordPress maintenance industry still hasn't solved.