<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Susumu Takahashi</title>
    <description>The latest articles on DEV Community by Susumu Takahashi (@susumun).</description>
    <link>https://dev.to/susumun</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961116%2F87a59747-8eb8-43eb-9db6-c160d3592934.JPG</url>
      <title>DEV Community: Susumu Takahashi</title>
      <link>https://dev.to/susumun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/susumun"/>
    <language>en</language>
    <item>
      <title>When WP-CLI fatals on the plugin you came to rescue</title>
      <dc:creator>Susumu Takahashi</dc:creator>
      <pubDate>Sun, 31 May 2026 12:30:33 +0000</pubDate>
      <link>https://dev.to/susumun/when-wp-cli-fatals-on-the-plugin-you-came-to-rescue-41hg</link>
      <guid>https://dev.to/susumun/when-wp-cli-fatals-on-the-plugin-you-came-to-rescue-41hg</guid>
      <description>&lt;p&gt;A WordPress plugin update breaks the site. You SSH in to roll back the bad plugin with WP-CLI, and you get this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Fatal&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Uncaught&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;...&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;broken&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plugin you came to fix has now stopped the tool you came to fix it with. It looks contradictory, but it makes sense once you know how WP-CLI starts up — and there's a flag pair that gets you out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why WP-CLI itself crashes
&lt;/h2&gt;

&lt;p&gt;When you run a rollback command like &lt;code&gt;wp plugin install &amp;lt;name&amp;gt; --version=X --force&lt;/code&gt;, WP-CLI internally &lt;strong&gt;boots WordPress before doing anything else&lt;/strong&gt;. Plugin registration and option loading all happen during WordPress's startup, so a broken plugin gets loaded there, throws a fatal, and takes the WP-CLI process down with it.&lt;/p&gt;

&lt;p&gt;The sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WP-CLI boots WordPress&lt;/li&gt;
&lt;li&gt;WordPress loads the active plugins&lt;/li&gt;
&lt;li&gt;The broken plugin throws a fatal&lt;/li&gt;
&lt;li&gt;WP-CLI exits before ever reaching the file-replace step&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The actual rollback (downloading the PHAR, overwriting the plugin directory) never gets a chance to run.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix — safe-mode flags
&lt;/h2&gt;

&lt;p&gt;WP-CLI has two startup flags, &lt;strong&gt;&lt;code&gt;--skip-plugins&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;--skip-themes&lt;/code&gt;&lt;/strong&gt;. With both set, &lt;strong&gt;WordPress's startup skips loading any plugins and themes at all&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wp plugin &lt;span class="nb"&gt;install&lt;/span&gt; &amp;lt;name&amp;gt; &lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;X &lt;span class="nt"&gt;--force&lt;/span&gt; &lt;span class="nt"&gt;--skip-plugins&lt;/span&gt; &lt;span class="nt"&gt;--skip-themes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;File-system operations (downloading the PHAR, unpacking it, replacing files) don't depend on plugin code, so they run fine. The broken plugin never gets loaded at boot, so it never fatals, and the rollback completes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should you set these flags everywhere?
&lt;/h2&gt;

&lt;p&gt;You might think "why not just add these to every WP-CLI command by default?" But some commands genuinely need plugins or themes loaded. &lt;code&gt;wp cache flush&lt;/code&gt; relies on the object-cache plugin's hooks. &lt;code&gt;wp doctor&lt;/code&gt; reads diagnostic information that plugins register. Setting safe-mode flags on those would break them in subtle ways.&lt;/p&gt;

&lt;p&gt;The practical split: &lt;strong&gt;file-operation commands always get &lt;code&gt;--skip-plugins --skip-themes&lt;/code&gt;. Cache and diagnostic commands don't.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That single rule eliminates the worst-case "WP-CLI doesn't work when you need it most" scenario from the maintenance workflow. For anyone running WP-CLI–based automation, this is a flag pair worth committing to muscle memory.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>php</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
