<?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: Bohdan Feniuk</title>
    <description>The latest articles on DEV Community by Bohdan Feniuk (@bohdan_feniuk).</description>
    <link>https://dev.to/bohdan_feniuk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4234610%2F0af3e366-5b49-4433-9d6c-9d157d57ace3.webp</url>
      <title>DEV Community: Bohdan Feniuk</title>
      <link>https://dev.to/bohdan_feniuk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bohdan_feniuk"/>
    <language>en</language>
    <item>
      <title>Craft CMS 6 Beta for Plugin Developers: Four Control Panel Changes in beta.3</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Sun, 06 Dec 2026 08:15:39 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/craft-cms-6-beta-for-plugin-developers-four-control-panel-changes-in-beta3-i56</link>
      <guid>https://dev.to/bohdan_feniuk/craft-cms-6-beta-for-plugin-developers-four-control-panel-changes-in-beta3-i56</guid>
      <description>&lt;p&gt;&lt;strong&gt;My plugin passed its tests on Craft 6 beta.3. Then I clicked around, and some of its buttons did nothing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/craftcms/cms/releases/tag/6.0.0-beta.3" rel="noopener noreferrer"&gt;Craft 6.0.0-beta.3&lt;/a&gt; came out on 2 December. For site builders it's mostly faster indexes and a new footer in the control panel. For plugin developers it also brings a few changes to Craft's own web components, the &lt;code&gt;&amp;lt;craft-button&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;craft-button-group&amp;gt;&lt;/code&gt; and friends that plugin UIs are now built from.&lt;/p&gt;

&lt;p&gt;None of them throws an error. The console stays clean, PHPStan has nothing to say, and the tests pass. You only notice when you use the plugin. Here are the four I ran into while updating &lt;a href="https://b10k.nl/plugins/component-guide/" rel="noopener noreferrer"&gt;Component Guide&lt;/a&gt;, with what you see, why it happens and how to fix it. (For the code-level traps, see &lt;a href="https://b10k.nl/blog/craft-6-silent-breaks/" rel="noopener noreferrer"&gt;what breaks without an error in Craft 6&lt;/a&gt;.)&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Small buttons in a group steal each other's clicks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; a row of small icon buttons, like desktop, tablet and phone. The first and last work. The one in the middle is almost impossible to click: clicks on it go to its neighbour.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; every &lt;code&gt;&amp;lt;craft-button&amp;gt;&lt;/code&gt; now has an invisible hit area of at least 44 × 44 px, drawn by its own &lt;code&gt;:host::before&lt;/code&gt; and centred on the button. It's there for accessibility (WCAG 2.5.5), and on a normal button you never notice it. But a small icon-only button is narrower than 44 px. Put three of them side by side and their hit areas overlap. The last button in the row sits on top, so it takes the clicks meant for the one before it.&lt;/p&gt;

&lt;p&gt;You can see it in DevTools: select the button and look for its &lt;code&gt;::before&lt;/code&gt;. It's larger than the button.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; inside your own groups, make the hit area the size of the button. Page styles win over a component's &lt;code&gt;:host&lt;/code&gt; styles, so this works from your plugin's CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.my-plugin&lt;/span&gt; &lt;span class="nt"&gt;craft-button-group&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;craft-button&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The group as a whole is still big enough to aim at. It also helps to build icon buttons the way Craft does in Live Preview: put a &lt;code&gt;&amp;lt;craft-icon&amp;gt;&lt;/code&gt; inside the button instead of using the &lt;code&gt;icon&lt;/code&gt; attribute, and give the button a width (&lt;code&gt;inline-size: calc(var(--c-size-control-sm) * 1.25)&lt;/code&gt;). The buttons are then wider and look like Craft's own.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A button group clears your &lt;code&gt;active&lt;/code&gt; state
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; you set &lt;code&gt;active&lt;/code&gt; on the button the user picked, and it doesn't stick. The button lights up and goes dark again, or nothing seems selected at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; &lt;code&gt;&amp;lt;craft-button-group&amp;gt;&lt;/code&gt; now manages selection itself, by value. The group has a &lt;code&gt;value&lt;/code&gt;. Whenever a button's &lt;code&gt;active&lt;/code&gt; changes, the group goes through its buttons and sets &lt;code&gt;active&lt;/code&gt; on the one whose &lt;code&gt;value&lt;/code&gt; matches its own, and removes it from the rest. A button without a &lt;code&gt;value&lt;/code&gt; never matches, so whatever your script sets, the group takes away.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; give each button a &lt;code&gt;value&lt;/code&gt;, and set the group's value when the selection changes. Craft's own Live Preview does it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;craft-button-group&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"device"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"desktop"&lt;/span&gt; &lt;span class="na"&gt;aria-label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Device"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;craft-button&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"desktop"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;craft-icon&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"desktop"&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Desktop"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/craft-icon&amp;gt;&amp;lt;/craft-button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;craft-button&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"tablet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;craft-icon&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"custom-icons/tablet-even"&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Tablet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/craft-icon&amp;gt;&amp;lt;/craft-button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;craft-button&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"phone"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;craft-icon&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"custom-icons/mobile-even"&lt;/span&gt; &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Phone"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/craft-icon&amp;gt;&amp;lt;/craft-button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/craft-button-group&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'tablet'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The group then keeps &lt;code&gt;active&lt;/code&gt; and &lt;code&gt;aria-pressed&lt;/code&gt; in line by itself. A click on a button with a &lt;code&gt;value&lt;/code&gt; also selects it and fires a &lt;code&gt;change&lt;/code&gt; event on the group, so you can listen there instead of on each button.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The last element in a header is no longer the close button
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; a button your plugin adds next to the close button in Live Preview's editor pane ends up after the close button instead of before it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; the close button is now a small Vue component that renders two elements: the &lt;code&gt;&amp;lt;craft-button&amp;gt;&lt;/code&gt; with the ✕, and a &lt;code&gt;&amp;lt;craft-tooltip&amp;gt;&lt;/code&gt; after it. Code that looks for "the last element in the header" finds the tooltip and puts its button between the two. And because Vue can re-create the close button later, a button that was placed correctly once can drift to the end again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; look for the last &lt;code&gt;&amp;lt;craft-button&amp;gt;&lt;/code&gt; in the header instead of the last element, and check the position again whenever the DOM changes, not only when you first add your button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;close&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;':scope &amp;gt; craft-button:not(.my-plugin-button)'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;myButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nextElementSibling&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insertBefore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myButton&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it from the same &lt;code&gt;MutationObserver&lt;/code&gt; that adds your button in the first place. The same idea applies anywhere you insert something next to Craft's controls: look for the control itself, not for a position.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;code&gt;devMode&lt;/code&gt; is always off
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; debug output that your plugin shows in dev mode, like a stack trace for a template that failed to render, never appears on Craft 6, even with &lt;code&gt;APP_DEBUG=true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; in Craft 6, debug mode comes from Laravel's &lt;code&gt;APP_DEBUG&lt;/code&gt;. The general config still has a &lt;code&gt;devMode&lt;/code&gt; property, but Craft doesn't set it from &lt;code&gt;APP_DEBUG&lt;/code&gt;. It stays &lt;code&gt;false&lt;/code&gt; unless a project still sets it in its config. So &lt;code&gt;Cms::config()-&amp;gt;devMode&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt;, and code that checks it never takes the debug path. Craft itself checks &lt;code&gt;app()-&amp;gt;hasDebugModeEnabled()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This one isn't new in beta.3. I found it the same week, while fixing the things Craft's Yii2 Loose Ends utility had just started showing me in my plugin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&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="c1"&gt;// Before&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Craft&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nv"&gt;$app&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getGeneral&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;devMode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; … &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// After&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;hasDebugModeEnabled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; … &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Twig, use the global &lt;code&gt;devMode&lt;/code&gt; variable. On Craft 6 it already reads from &lt;code&gt;APP_DEBUG&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you catch these?
&lt;/h2&gt;

&lt;p&gt;None of them shows up in tests or static analysis. What worked for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Update a test site to each new beta and click through your plugin.&lt;/strong&gt; Every page, every button, the entry editor and Live Preview. These changes only show when you use the UI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Craft's components, the way Craft uses them.&lt;/strong&gt; Most of my problems came from markup that worked on beta.2 but wasn't how Craft builds the same control. Live Preview's toolbar was the best reference: it has the same kind of buttons most plugins need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Yii2 Loose Ends.&lt;/strong&gt; Since beta.3 it also lists old Craft 5 calls in plugins installed from a local path repository, each with the file, the line and the replacement. It catches the PHP side; the four things above it can't see.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update from the terminal, not from the control panel.&lt;/strong&gt; During the beta the Yii2 adapter requires the exact same Craft version, and the control panel's updater only updates Craft itself, so it fails. &lt;code&gt;composer update craftcms/cms craftcms/yii2-adapter -W&lt;/code&gt; updates both.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Will these change again before Craft 6.0?
&lt;/h3&gt;

&lt;p&gt;Possibly. Craft 6 is still in beta, and Pixel &amp;amp; Tonic are still working on the control panel. That's why it pays to build with Craft's components and their attributes rather than around them: when the component changes, your UI changes with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do these affect my plugin on Craft 5?
&lt;/h3&gt;

&lt;p&gt;No. Craft 5's control panel doesn't use these components. If your plugin supports both, keep the Craft 6 markup in your Craft 6 version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not override the 44 px hit area everywhere?
&lt;/h3&gt;

&lt;p&gt;Because it's there for people who use a touch screen or have trouble aiming. Only remove it where buttons sit close enough to overlap, and keep the group itself easy to hit.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm Bohdan, a freelance Craft developer at &lt;a href="https://b10k.nl" rel="noopener noreferrer"&gt;b10k&lt;/a&gt;. I build Craft sites, take care of &lt;a href="https://b10k.nl/maintenance/" rel="noopener noreferrer"&gt;Craft CMS upgrades&lt;/a&gt; and make a few &lt;a href="https://b10k.nl/plugins/" rel="noopener noreferrer"&gt;Craft plugins&lt;/a&gt;, all three on the Craft 6 beta. Porting a plugin or a site to Craft 6? Start with a &lt;a href="https://b10k.nl/craft-6/" rel="noopener noreferrer"&gt;Craft 6 readiness check&lt;/a&gt;, &lt;a href="mailto:me@b10k.nl"&gt;email me&lt;/a&gt; or find me on &lt;a href="https://linkedin.com/in/bohdanfeniuk" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>craftcms</category>
      <category>php</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A Full Craft CMS Page in Two Prompts with MCP</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Sun, 29 Nov 2026 10:18:51 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/a-full-craft-cms-page-in-two-prompts-with-mcp-5cb6</link>
      <guid>https://dev.to/bohdan_feniuk/a-full-craft-cms-page-in-two-prompts-with-mcp-5cb6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Two prompts, 2 minutes 53 seconds, and a seven-block About Us page was live.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We connected Claude Code to a Craft CMS site through Craft’s new MCP server and asked it to build a page. It picked the blocks, filled them in, created the page and checked that it loads. Nobody opened the control panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6n419pm1l848zontarzs.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6n419pm1l848zontarzs.webp" alt="The About Us page the agent built: a dark Hero, a Section Intro, a Timeline, a Stats Bar, a Team Grid, a dark Pull Quote and a CTA Split" width="800" height="1496"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The page as it went live. Velo Studio is our demo site, a made-up cycling studio.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://b10k.nl/plugins/component-guide/" rel="noopener noreferrer"&gt;See Component Guide for Craft CMS →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What MCP is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;MCP (Model Context Protocol) is a standard way for an AI agent to talk to an app. Since version 5.12, Craft has its own MCP server. Switch it on, connect an agent such as Claude Code, and the agent can read your sections, entry types and fields, and create entries — with the same permissions as the user who signed in.&lt;/p&gt;
&lt;h2&gt;
  
  
  The two prompts
&lt;/h2&gt;

&lt;p&gt;The first prompt was a question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do you see any blocks can be used for pages?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Seven seconds later the agent answered with a list of 30 blocks, the ones marked as ready for editors. That list didn’t come from Craft. Craft would have shown the agent every entry type on the site, finished or not. The list came from Component Guide, which adds it to what Craft’s MCP server tells the agent (more on that below).&lt;/p&gt;

&lt;p&gt;The second prompt pointed back at that list:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Create the About Us page with those blocks&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;“With those blocks” is the important part. Ask an agent only to create an About Us page, and it will make one its own way: a new single with a few fields it thinks a page needs. That’s a page, but not one built from your blocks, and not one your editors can work with the way they work with every other page.&lt;/p&gt;

&lt;p&gt;So the agent took the list as its menu: choose the blocks that suit an About Us page, fill them in, and put the page on the site. It chose seven of the 30.&lt;/p&gt;

&lt;p&gt;The site had no section for a page like this. So the agent created one first — a Pages section with a Page entry type — and then built the page in it.&lt;/p&gt;

&lt;p&gt;How it went, by the clock:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;0:00&lt;/strong&gt; Prompt 1: “Do you see any blocks can be used for pages?”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0:07&lt;/strong&gt; The answer: the 30 blocks ready for editors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1:31&lt;/strong&gt; Prompt 2: “Create the About Us page with those blocks”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2:18&lt;/strong&gt; The agent has created a Pages section and a Page entry type: the site had nowhere to put the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2:44&lt;/strong&gt; The entry is saved with seven blocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2:53&lt;/strong&gt; The live page is checked: it loads, and all seven blocks render.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From the second prompt to a checked, live page took 82 seconds. The agent made 11 calls to the MCP server on the way.&lt;/p&gt;
&lt;h2&gt;
  
  
  The page
&lt;/h2&gt;

&lt;p&gt;Seven blocks, top to bottom:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hero&lt;/strong&gt;, dark: “A workshop built by riders, for riders”, with the photo the home page already uses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Section Intro&lt;/strong&gt;: “Comfort first, speed follows”.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timeline&lt;/strong&gt;: from a garage in 2016 to today.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stats Bar&lt;/strong&gt;: bike fittings, years, team size, rating.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Team Grid&lt;/strong&gt;: four people.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pull Quote&lt;/strong&gt;, dark: a line from a co-founder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CTA Split&lt;/strong&gt;: “Book a fitting” and “Contact us”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The agent also read the home page and the Hero’s examples before writing, so the new text sounds like the rest of the site.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Component Guide adds to Craft’s MCP server
&lt;/h2&gt;

&lt;p&gt;On its own, Craft’s MCP server describes the content model: which entry types exist and which fields they have. That’s enough to save an entry. It isn’t enough to build a good page. A field list doesn’t say that Stats Bar is a row of big numbers, that a block is still a draft, or what a well-filled Hero looks like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://b10k.nl/plugins/component-guide/" rel="noopener noreferrer"&gt;Component Guide&lt;/a&gt; knows those things, because a developer has already written them down. Next to each block template sits a story file with example content for the block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight twig"&gt;&lt;code&gt;'Dark': {
    description: 'Same content on the dark theme, for pages that open into a dark section.',
    args: {
        theme: 'dark',
        eyebrow: 'Velo Studio',
        heading: 'Ride better, not just harder',
        buttonLabel: 'Book a fitting',
        ...
    },
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The developer uses these files to see every block in the control panel, and editors use them to pick blocks from a gallery. Since Craft 5.12, the plugin hands the same knowledge to the agent, in three ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Which blocks to use.&lt;/strong&gt; When the agent connects, Craft gives it a set of instructions. Component Guide adds the blocks that are ready for editors: marked stable, with examples, and matched to an entry type. On this site that’s 30 of 31 — the list the agent showed after the first prompt. With client review on, the list also says which examples the client approved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What goes in them.&lt;/strong&gt; The tool &lt;code&gt;component-guide.stories&lt;/code&gt; returns a block’s examples. The agent starts from content that already works for that block, not from an empty list of fields. In this run it read the Hero’s examples and the home page before writing, so the new text sounds like the rest of the site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What they look like.&lt;/strong&gt; The tool &lt;code&gt;component-guide.render&lt;/code&gt; renders any block from the site’s own templates, with any values, and returns the HTML — or the error the template throws. Nothing is saved. An agent can check a block before it puts it on a page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There’s a fourth, for developers: Craft’s own content-model check (&lt;code&gt;content-model.audit&lt;/code&gt;) now also lists examples that use a field the entry type doesn’t have, and fields no template reads.&lt;/p&gt;

&lt;p&gt;All of this comes from files the project already has. There is nothing to configure for MCP: the tools appear for everyone who has access to the guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a person still has to do
&lt;/h2&gt;

&lt;p&gt;The page was live in three minutes. It wasn’t finished.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The text is made up.&lt;/strong&gt; The team names, the years, the 2,500 fittings and the quote are placeholders the agent wrote — and its report said so. On a real site, every one needs replacing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some links go nowhere.&lt;/strong&gt; The buttons point to &lt;code&gt;#&lt;/code&gt;, and “Meet the team” points to &lt;code&gt;#team&lt;/code&gt;, an anchor the Team Grid doesn’t have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Navigation.&lt;/strong&gt; Nothing in the header links to the new page yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draft, not live.&lt;/strong&gt; We published straight away because it’s a demo. On a client site, ask the agent for a draft.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Config changes.&lt;/strong&gt; The new section and entry type landed in project config, as YAML files to review and commit like any other change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The three minutes replaced the assembly: choosing blocks, creating the section, filling every field with something sensible. They didn’t replace knowing what’s true about the business.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set it up
&lt;/h2&gt;

&lt;p&gt;With MCP switched on in Craft (Settings → MCP → Authenticated), connecting Claude Code is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;claude mcp add --transport http velo https://your-site.test/admin/mcp/auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run &lt;code&gt;/mcp&lt;/code&gt; in Claude Code, pick the server, and approve access on Craft’s consent page in the browser.&lt;/p&gt;

&lt;p&gt;Two things cost us a few minutes on a fresh install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Signing keys.&lt;/strong&gt; The endpoint returned a server error (500) until we ran &lt;code&gt;php craft oauth/generate-keys&lt;/code&gt;. The keys are saved in &lt;code&gt;storage/&lt;/code&gt;, so every environment needs them once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The URL.&lt;/strong&gt; Use the authorization endpoint, &lt;code&gt;/admin/mcp/auth&lt;/code&gt;, not &lt;code&gt;/admin/mcp&lt;/code&gt;. Craft tells clients that this is the address to sign in to, and Claude Code refused the other one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;You need three things: Craft 5.12 or later with MCP switched on, an MCP client such as Claude Code, and blocks with stories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://b10k.nl/plugins/component-guide/" rel="noopener noreferrer"&gt;Component Guide&lt;/a&gt; Lite is free on any site, MCP tools included. The demo runs Pro, which also gives the agent the field values to fill a new block with, and the client’s approvals. Craft documents the server itself in its &lt;a href="https://craftcms.com/docs/5.x/system/mcp" rel="noopener noreferrer"&gt;MCP docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then ask the agent which of your blocks it can use for pages.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://b10k.nl/blog/craft-cms-page-in-two-prompts/" rel="noopener noreferrer"&gt;b10k.nl&lt;/a&gt;. I'm Bohdan, a freelance Craft CMS developer in the Netherlands. The tool in this article is &lt;a href="https://b10k.nl/plugins/component-guide/" rel="noopener noreferrer"&gt;Component Guide&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>craftcms</category>
      <category>ai</category>
      <category>mcp</category>
      <category>php</category>
    </item>
    <item>
      <title>Upgrading Craft 4 to Craft 5: Lessons from a Real Project</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Sun, 29 Nov 2026 10:18:19 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/upgrading-craft-4-to-craft-5-lessons-from-a-real-project-14f</link>
      <guid>https://dev.to/bohdan_feniuk/upgrading-craft-4-to-craft-5-lessons-from-a-real-project-14f</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Craft upgrade itself is one command. Everything around it is the project.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This autumn I upgraded a company website from Craft 4 to Craft 5. A mid-sized site: 108 fields, 16 sections, a dozen commercial plugins, a page builder made of Neo blocks with Matrix fields inside them, and a custom plugin that handles payments. Nothing exotic, which is exactly why the lessons apply to most Craft 4 sites still out there.&lt;/p&gt;

&lt;p&gt;Here's what the upgrade actually involved, in the order it happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it couldn't wait
&lt;/h2&gt;

&lt;p&gt;The site worked fine on Craft 4. The reason to move was security:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Craft 4 pins Twig to the &lt;strong&gt;3.19&lt;/strong&gt; line. The fixes for several Twig sandbox vulnerabilities, one of them critical, only exist from &lt;strong&gt;3.26&lt;/strong&gt; on, and that version is only reachable on Craft 5.&lt;/li&gt;
&lt;li&gt;The project pinned Composer's platform PHP to 8.0, which froze the Symfony packages on a version line that no longer gets security fixes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;composer audit&lt;/code&gt; reported &lt;strong&gt;31 advisories across 8 packages&lt;/strong&gt;. None of them could be fixed within Craft 4's constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a site reaches the point where &lt;code&gt;composer update&lt;/code&gt; can't fix a known vulnerability, staying put is no longer the safe option.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Take inventory before touching anything
&lt;/h2&gt;

&lt;p&gt;Before changing a single line, I listed every plugin, field and piece of custom code, and what Craft 5 would mean for each. The plugins fell into four groups:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Group&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;th&gt;Examples from this site&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Same major on both&lt;/td&gt;
&lt;td&gt;Works on Craft 4 and 5 — no jump&lt;/td&gt;
&lt;td&gt;Freeform, NoCache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New major version&lt;/td&gt;
&lt;td&gt;Bump the constraint, check the upgrade notes&lt;/td&gt;
&lt;td&gt;Neo, CKEditor, Blitz, SEOmatic, Retour, Sprig&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not needed&lt;/td&gt;
&lt;td&gt;Remove before the upgrade&lt;/td&gt;
&lt;td&gt;Super Table (used by zero fields), an internal utility plugin, a minifier made redundant by Blitz&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Abandoned&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No Craft 5 version at all&lt;/td&gt;
&lt;td&gt;A link field plugin (&lt;code&gt;typedlinkfield&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The field layer is where the risk lives. On this site that meant ten Matrix fields, two Neo fields, and &lt;strong&gt;six places where a Matrix field sat inside a Neo block&lt;/strong&gt; — after the upgrade, Matrix blocks become entries, so that becomes entry → Neo block → nested entry. Craft 5 also moves to one global field namespace, which surfaced handle collisions: four fields called &lt;code&gt;linkField&lt;/code&gt;, three called &lt;code&gt;copy&lt;/code&gt;, two &lt;code&gt;text&lt;/code&gt;, two &lt;code&gt;image&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Twig side, by contrast, was small: 61 templates, and only 13 lines that touched Matrix or Neo directly. A few needed fixing — a malformed eager-load, a nested query inside a loop — but templates were not the hard part.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Ship the cleanup on Craft 4 first
&lt;/h2&gt;

&lt;p&gt;Everything that could be done on Craft 4 went to production on Craft 4, as a separate release: removing Super Table and the unused plugins, deleting two orphaned fields, clearing out dead code. If something goes wrong there, rollback is an ordinary Craft 4 revert.&lt;/p&gt;

&lt;p&gt;Two commands in that release turned out to be essential:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;php craft neo/block-types/resave&lt;/code&gt;&lt;/strong&gt; — guards against a known Neo pitfall where block content can be lost during the upgrade (&lt;a href="https://github.com/spicywebau/craft-neo/issues/943" rel="noopener noreferrer"&gt;Neo #943&lt;/a&gt;). Run it on Craft 4, before upgrading.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;php craft utils/fix-field-layout-uids&lt;/code&gt;&lt;/strong&gt; — I only found this one during a local test run. Craft 5's content migration refused to run because field layout elements shared UIDs: the Neo block types had been created by copying each other, which left &lt;strong&gt;26 duplicates&lt;/strong&gt;. The fix command only exists on Craft 4.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the order matters. &lt;code&gt;craft up&lt;/code&gt; runs migrations &lt;em&gt;before&lt;/em&gt; it applies project config. If the UID fix arrived together with the Craft 5 code, production's migration would fail on the same check. So the cleanup has to be live on Craft 4 before the Craft 5 release is deployed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: The abandoned plugin decides the plan
&lt;/h2&gt;

&lt;p&gt;The link field plugin had no Craft 5 version, and its &lt;code&gt;composer.json&lt;/code&gt; required &lt;code&gt;craftcms/cms: ^4.0.0&lt;/code&gt;. That means it can't even be installed next to Craft 5: it has to disappear in the same commit that bumps Craft. There's no automated migration from it to Craft's native Link field — &lt;a href="https://github.com/craftcms/cms/discussions/15993" rel="noopener noreferrer"&gt;third-party migrations are DIY&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What made it manageable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;composer remove&lt;/code&gt;, never uninstall in the control panel.&lt;/strong&gt; The plugin kept its values in its own database table. Removing the package leaves the table in place; uninstalling in the CP would have dropped it, along with every link on the site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One native Link field replaced ten old ones.&lt;/strong&gt; All ten behaved the same way, so a single multi-instance field (&lt;code&gt;hyperlink&lt;/code&gt;, because &lt;code&gt;link&lt;/code&gt; is a reserved handle) was enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the layout element UIDs and the old handles.&lt;/strong&gt; In each of the ten field layouts, the old element was switched to the new field with its UID unchanged and its old handle as an override. Templates kept calling &lt;code&gt;block.button&lt;/code&gt; and &lt;code&gt;item.linkField&lt;/code&gt; as before.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A content migration copied the old table into Craft 5's content storage&lt;/strong&gt; under those UIDs — including drafts, revisions and trashed entries. It ran inside &lt;code&gt;craft up&lt;/code&gt;, needing neither the old plugin nor the new field to exist yet.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because &lt;code&gt;craft up&lt;/code&gt; and the older &lt;code&gt;migrate/all&lt;/code&gt; + &lt;code&gt;project-config/sync&lt;/code&gt; run things in a different order, I tested the full deploy both ways from the same database snapshot. Both migrated all &lt;strong&gt;444 links&lt;/strong&gt;, and every migrated value was checked against its original row.&lt;/p&gt;

&lt;p&gt;One behaviour difference only showed up in that comparison: the old plugin output nothing for a link to a disabled entry, while Craft's native link returns its URL anyway. Every template now calls &lt;code&gt;getUrl(false)&lt;/code&gt;, which keeps the old behaviour. On this site, one live link on the home page would otherwise have pointed at a disabled page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Custom code finds old bugs
&lt;/h2&gt;

&lt;p&gt;The custom payments plugin needed the usual Craft 5 changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The sections service is gone: &lt;code&gt;getSections()&lt;/code&gt; → &lt;code&gt;getEntries()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$entry-&amp;gt;enabledForSite = …&lt;/code&gt; → &lt;code&gt;setEnabledForSite()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;New entries need an entry type ID as well as a section ID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;$entry-&amp;gt;section&lt;/code&gt; is null for nested entries.&lt;/strong&gt; A global "after save" handler read &lt;code&gt;$entry-&amp;gt;section-&amp;gt;handle&lt;/code&gt; — fine on Craft 4, a fatal error on Craft 5 the first time anyone saved a Matrix block. Now it's &lt;code&gt;getSection()?-&amp;gt;handle&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Porting it also uncovered bugs that had been there all along: a namespace case mismatch, a call that would have been fatal in one webhook branch, and a lookup that never matched anything, so a status update had silently never happened. An upgrade is a rare moment when someone reads every line of old custom code; it's worth fixing what turns up.&lt;/p&gt;

&lt;p&gt;The payment webhooks were tested locally with signed test events for every case the plugin handles, before the code went anywhere near staging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Deploy like it can go wrong
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Use &lt;code&gt;craft up&lt;/code&gt; in the deploy.&lt;/strong&gt; The host's post-deploy tasks ran &lt;code&gt;migrate/all&lt;/code&gt; and then &lt;code&gt;project-config/sync&lt;/code&gt;. Those became a single &lt;code&gt;php craft up --interactive=0&lt;/code&gt;, which runs migrations and applies project config in the right order. It already works on Craft 4, so that change can go in before the upgrade.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switch PHP at the last moment.&lt;/strong&gt; On this host the PHP version applies to the next build, so it was raised from 8.1 to 8.3 right before the Craft 5 deploy — not earlier, not later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compare the whole site, not a few pages.&lt;/strong&gt; On staging I crawled all &lt;strong&gt;180 URLs&lt;/strong&gt; before and after the upgrade and compared status codes, links, text, meta tags and images. They matched. That says more than an afternoon of clicking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch out for migrations that succeed without doing anything.&lt;/strong&gt; One intermediate commit had a bug: &lt;code&gt;craft up&lt;/code&gt; would skip all 444 links but still record the migration as done — after which the fixed migration could never run. It never reached any environment, but it changed how I deploy: production gets exactly two known builds, in a fixed order, and nothing in between.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Expect environment surprises.&lt;/strong&gt; Staging's database was a fresh copy of production, but some environment variables weren't — the form's reCAPTCHA keys were missing, so submissions failed. Nothing to do with Craft 5, and exactly the kind of thing that wastes an hour if you assume the upgrade broke it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Know your point of no return
&lt;/h2&gt;

&lt;p&gt;Before &lt;code&gt;craft up&lt;/code&gt; runs on production, rollback is simple: the previous build plus the database backup taken minutes earlier. After it, rollback is still possible — until editors start adding content. From that moment, rolling back means losing their work.&lt;/p&gt;

&lt;p&gt;So the production cutover gets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a low-traffic window and a &lt;strong&gt;content freeze&lt;/strong&gt; announced to editors;&lt;/li&gt;
&lt;li&gt;an on-demand database backup right before the deploy, with a downloaded copy;&lt;/li&gt;
&lt;li&gt;a rollback that's been &lt;strong&gt;rehearsed once on staging&lt;/strong&gt;, so it's a known 15-minute procedure rather than an improvisation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where it stands
&lt;/h2&gt;

&lt;p&gt;At the time of writing, the upgrade runs on staging and has passed the full comparison; the team is doing its own checks before the production cutover. I'll add how production went once it's done.&lt;/p&gt;

&lt;h2&gt;
  
  
  A checklist for your own Craft 4 → 5 upgrade
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run &lt;code&gt;composer audit&lt;/code&gt;.&lt;/strong&gt; If it reports issues Craft 4 can't fix, the upgrade is a security task, not a nice-to-have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inventory plugins&lt;/strong&gt; into: same major, new major, not needed, abandoned. The abandoned ones shape the plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ship the cleanup on Craft 4 first&lt;/strong&gt;, including &lt;code&gt;neo/block-types/resave&lt;/code&gt; and &lt;code&gt;utils/fix-field-layout-uids&lt;/code&gt; if you use Neo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remove abandoned plugins with &lt;code&gt;composer remove&lt;/code&gt;&lt;/strong&gt;, not the control panel, so their data survives for the migration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the deploy from a production snapshot&lt;/strong&gt;, with the exact commands your host runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diff the whole site&lt;/strong&gt; before and after, not just a handful of pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan the point of no return&lt;/strong&gt;: content freeze, fresh backup, rehearsed rollback.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same habits will matter even more for &lt;a href="https://b10k.nl/blog/craft-6-upgrade/" rel="noopener noreferrer"&gt;the move to Craft 6&lt;/a&gt;: it can only be reached from the latest Craft 5, so a site still on Craft 4 has two upgrades ahead of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What should I do on Craft 4 before upgrading to Craft 5?
&lt;/h3&gt;

&lt;p&gt;Clean up first and ship that as its own release: remove plugins you don't use, delete unused fields, and if you use Neo, run the two commands from step 2. A problem is much easier to undo while you're still on Craft 4.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I move links from Typed Link Field to Craft 5's Link field?
&lt;/h3&gt;

&lt;p&gt;There's no ready-made tool. Remove the old plugin with &lt;code&gt;composer remove&lt;/code&gt; so its data stays in the database, add a native Link field, and copy the old values over in a content migration. On this site that moved all 444 links.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I uninstall an abandoned plugin in the control panel?
&lt;/h3&gt;

&lt;p&gt;Not if you still need its data. Uninstalling there can delete the plugin's database table. &lt;code&gt;composer remove&lt;/code&gt; takes away the code and leaves the data alone.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://b10k.nl/blog/craft-4-to-5-upgrade/" rel="noopener noreferrer"&gt;b10k.nl&lt;/a&gt;. I'm Bohdan, a freelance Craft CMS developer in the Netherlands. Planning the move to Craft 6? Start with a &lt;a href="https://b10k.nl/craft-6/" rel="noopener noreferrer"&gt;Craft 6 readiness check&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>craftcms</category>
      <category>php</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Craft CMS 6 Beta: What Breaks Without an Error</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Mon, 23 Nov 2026 09:34:25 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/craft-cms-6-beta-what-breaks-without-an-error-5hb4</link>
      <guid>https://dev.to/bohdan_feniuk/craft-cms-6-beta-what-breaks-without-an-error-5hb4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Most of your Craft 5 code keeps working on Craft 6. The trouble is the part that stops working without saying so.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Craft 6 is Craft rebuilt on Laravel, and Pixel &amp;amp; Tonic did a lot to make the move gentle. The &lt;a href="https://craftcms.com/docs/6.x/extend/adapter" rel="noopener noreferrer"&gt;Yii2 adapter&lt;/a&gt; lets Craft 5 plugins and modules run on Craft 6, and the &lt;code&gt;craft6-revamp&lt;/code&gt; tool moves your project into the new folder layout for you. (If you want the bigger picture first, start with &lt;a href="https://b10k.nl/blog/craft-6-upgrade/" rel="noopener noreferrer"&gt;what changes in Craft 6&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;I've just been through it: a demo site upgraded from Craft 5 to the 6.0 beta, and my three plugins ported to it. Most things either worked or failed loudly, with an error that told me what to fix. Those are easy. This article is about the other kind: code that runs without complaint and quietly does something different.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is a silent break worse than an error?
&lt;/h2&gt;

&lt;p&gt;Because nothing points at it. The page loads, the control panel opens, your tests pass, and you move on. Weeks later someone notices that a label is wrong, a check never ran, or a button never shows up. By then you're looking for the cause in a much bigger haystack.&lt;/p&gt;

&lt;p&gt;Everything below was found the hard way. For each one: what you see, why it happens, and what to change.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;instanceof&lt;/code&gt; checks quietly return false
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; a feature that depends on the field type just stops, with no error. A Matrix field is no longer treated as a Matrix field.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; the adapter keeps the old class names, like &lt;code&gt;craft\fields\Matrix&lt;/code&gt;, so your code still loads. But they are &lt;em&gt;subclasses&lt;/em&gt; of the new Craft 6 classes, not the same class under another name. Craft hands you the new class, &lt;code&gt;CraftCms\Cms\Field\Matrix&lt;/code&gt;. So &lt;code&gt;$field instanceof craft\fields\Matrix&lt;/code&gt; is false. With a type hint you're luckier: that one throws an error you'll see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; import the Craft 6 classes:&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="c1"&gt;// Before&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;craft&lt;/span&gt;\&lt;span class="n"&gt;fields&lt;/span&gt;\&lt;span class="nc"&gt;Matrix&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;craft&lt;/span&gt;\&lt;span class="n"&gt;elements&lt;/span&gt;\&lt;span class="nc"&gt;Entry&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;craft&lt;/span&gt;\&lt;span class="n"&gt;base&lt;/span&gt;\&lt;span class="nc"&gt;FieldInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// After&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Field&lt;/span&gt;\&lt;span class="nc"&gt;Matrix&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Entry&lt;/span&gt;\&lt;span class="nc"&gt;Elements&lt;/span&gt;\&lt;span class="nc"&gt;Entry&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Field&lt;/span&gt;\&lt;span class="nc"&gt;Contracts&lt;/span&gt;\&lt;span class="nc"&gt;FieldInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same goes for the other field types, &lt;code&gt;ElementInterface&lt;/code&gt;, &lt;code&gt;User&lt;/code&gt;, &lt;code&gt;EntryType&lt;/code&gt; and &lt;code&gt;GeneralConfig&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Class names written as strings point nowhere
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; code that sniffs for an optional plugin takes the "not installed" branch even though the plugin is right there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; a check like &lt;code&gt;is_a($field, 'craft\\ckeditor\\Field')&lt;/code&gt; is just a string. Imports, your IDE and static analysis all skip it. In Craft 6 the class is &lt;code&gt;CraftCms\Ckeditor\Field&lt;/code&gt;, and a case-sensitive &lt;code&gt;str_contains($class, '\\ckeditor\\')&lt;/code&gt; misses the capital C.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; search your code for &lt;code&gt;'craft\\&lt;/code&gt; and for namespace fragments in strings. Update the names, and compare lowercased strings when you only want to know which package a class comes from.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A constant became an enum, and the comparison is always false
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; behaviour that depends on a type silently takes the other path. In my case, a single without a title was labelled with its slug instead of its section name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; in Craft 6 some values that used to be strings are now PHP enums. A section's &lt;code&gt;type&lt;/code&gt; is &lt;code&gt;SectionType::Single&lt;/code&gt;, not &lt;code&gt;'single'&lt;/code&gt;. So &lt;code&gt;$section-&amp;gt;type === Section::TYPE_SINGLE&lt;/code&gt; compares an enum with a string and is never true. PHP doesn't complain about that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt;&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="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Section&lt;/span&gt;\&lt;span class="nc"&gt;Enums&lt;/span&gt;\&lt;span class="nc"&gt;SectionType&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$section&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nc"&gt;SectionType&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Single&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; … &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static analysis found this one, not me (more on that below).&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;code&gt;securityKey&lt;/code&gt; is gone, and anything signed with it signs nothing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; a feature that relies on a signed token turns itself off, or worse, stops checking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Craft 6 uses Laravel's &lt;code&gt;APP_KEY&lt;/code&gt;. The general config no longer has a &lt;code&gt;securityKey&lt;/code&gt;, and through the adapter it reads as an empty string. Code that signs or verifies something with it gets an empty key and doesn't fail.&lt;/p&gt;

&lt;p&gt;This one got my own plugin. Component Check signs the markers it puts around Matrix blocks, so it can compare each block with its snapshot. With an empty key, every run quietly fell back to whole-page checks. The result was green, but no block had been compared at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; use &lt;code&gt;config('app.key')&lt;/code&gt;, and say "APP_KEY" in your error messages.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;code&gt;transform()&lt;/code&gt; gives you a picture, not the asset
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; images that look fine on the front end, until you turn on debug mode and the template throws an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; &lt;code&gt;asset.setTransform()&lt;/code&gt; is deprecated, and the obvious replacement, &lt;code&gt;asset.transform()&lt;/code&gt;, doesn't return the asset. It returns a small result object: URL, width, height and file details, and that's all. Call &lt;code&gt;getSrcset()&lt;/code&gt; or &lt;code&gt;alt&lt;/code&gt; on it and normal Twig just prints nothing. Strict Twig, which you get with &lt;code&gt;APP_DEBUG=true&lt;/code&gt;, throws.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; keep the asset and the transform result apart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight twig"&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;heroImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;one&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'crop'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;resized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;null&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ resized.url }}"&lt;/span&gt;
     &lt;span class="na"&gt;srcset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ image.getSrcset(['400w', '800w', '1200w'], size) }}"&lt;/span&gt;
     &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ resized.width }}"&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ resized.height }}"&lt;/span&gt;
     &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ image.alt }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And test your templates with &lt;code&gt;APP_DEBUG=true&lt;/code&gt; at least once.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Craft 5.12's MCP code registers nothing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; your plugin's tools are simply missing from Craft's MCP server. No warning anywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Craft 5.12 brought an MCP server, and plugins could add tools to it through &lt;code&gt;craft\services\Mcp&lt;/code&gt;. Craft 6 still has an MCP server, but under a new API (&lt;code&gt;CraftCms\Cms\Mcp&lt;/code&gt;). Plugins that carefully wrote &lt;code&gt;if (class_exists(\craft\services\Mcp::class))&lt;/code&gt; now skip the whole thing, and that check was supposed to make them safe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; register through Craft 6's registries and events:&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="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Mcp&lt;/span&gt;\&lt;span class="nc"&gt;CapabilityRegistry&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;CapabilityRegistry&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MyTools&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instructions go through the &lt;code&gt;CollectingAdminInstructions&lt;/code&gt; and &lt;code&gt;CollectingServerInstructions&lt;/code&gt; events. Also note that tool names in Craft 6 use underscores (&lt;code&gt;info_get&lt;/code&gt;, &lt;code&gt;content_model_audit&lt;/code&gt;), so &lt;code&gt;myplugin.results&lt;/code&gt; becomes &lt;code&gt;myplugin_results&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Your control panel JavaScript doesn't load where editors work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; a script or button your plugin adds to the entry editor doesn't appear. Your plugin's own settings pages work fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; the Craft 6 control panel is a Vue app. The entry editor and Live Preview are Vue pages, and they don't have the Twig page template that plugins used to hook into. Assets registered from that hook never reach them. Older Twig pages, like a plugin's own pages, are now drawn into the app &lt;em&gt;after&lt;/em&gt; the page has loaded. So a script that runs once on load can find nothing to attach to, and it won't log an error either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; register scripts and styles with Craft 6's plugin service, which prints them on every control panel page:&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="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;\&lt;span class="nc"&gt;CraftCms&lt;/span&gt;\&lt;span class="nc"&gt;Cms&lt;/span&gt;\&lt;span class="nc"&gt;Plugin&lt;/span&gt;\&lt;span class="nc"&gt;Plugins&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;addScript&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then write the script so it doesn't assume the page is already there. A small custom element that starts your code when it's connected works on both Craft 5 and 6.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. The control panel's CSS classes are gone
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What you see:&lt;/strong&gt; buttons that look like plain text, tabs that turn into a row of links, cards without borders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Craft 5's CSS classes (&lt;code&gt;.btn&lt;/code&gt;, &lt;code&gt;.card&lt;/code&gt;, the tab markup and others) aren't part of the Craft 6 control panel. Its buttons, tabs, inputs and cards are web components now: &lt;code&gt;&amp;lt;craft-button&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;craft-tabs&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;craft-input&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;craft-card&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; build your UI from those components rather than copying the old styles into your plugin. You get dark mode for free, and your pages keep up when Craft's design changes. The beta design will change before 6.0, so that matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you catch these?
&lt;/h2&gt;

&lt;p&gt;Not by clicking around. Most of them pass a quick look. What worked for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run PHPStan against Craft 6, not Craft 5.&lt;/strong&gt; Your plugin's own &lt;code&gt;vendor&lt;/code&gt; folder probably still has Craft 5 in it. Run the analysis inside a Craft 6 project instead. With DDEV, mount the plugin into the site and run &lt;code&gt;composer update &amp;amp;&amp;amp; composer check&lt;/code&gt; there. That's how the enum comparison and the leftover type hints turned up. Tests alone didn't show them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compare blocks, not just pages.&lt;/strong&gt; Take a visual snapshot of your blocks on Craft 5 before you upgrade, and compare against it on Craft 6. Then check that the comparison really happened. After #4, I don't trust a green result until it says what it compared.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn on &lt;code&gt;APP_DEBUG=true&lt;/code&gt;&lt;/strong&gt; while you test, so Twig is strict and errors show their real message instead of a generic error page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read Craft's own lists.&lt;/strong&gt; The adapter adds a &lt;strong&gt;Yii2 Loose Ends&lt;/strong&gt; utility to the control panel. It lists the old APIs your project still uses, in templates, modules and config, each with a note on what to change. It doesn't point into plugin code: plugins only appear as a whole, in a list of the ones that still need the adapter, with an update if one exists. Deprecation Warnings does include plugin code, with the file and line, but only for the few things Craft 6 itself logs there. So for your own plugin, PHPStan against Craft 6 is the better net.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A short checklist
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Old class imports swapped for &lt;code&gt;CraftCms\Cms\…&lt;/code&gt; ones.&lt;/li&gt;
&lt;li&gt;Class names in strings searched and updated.&lt;/li&gt;
&lt;li&gt;Comparisons with old constants checked for enums.&lt;/li&gt;
&lt;li&gt;Nothing signs or verifies with &lt;code&gt;securityKey&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform()&lt;/code&gt; results not used as assets; templates tested with &lt;code&gt;APP_DEBUG=true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;MCP tools registered through the Craft 6 API, with underscore names.&lt;/li&gt;
&lt;li&gt;Control panel scripts registered through the plugin service, and safe when the page arrives late.&lt;/li&gt;
&lt;li&gt;Control panel UI built from Craft 6 components.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Isn't the Yii2 adapter enough on its own?
&lt;/h3&gt;

&lt;p&gt;It gets you most of the way. It keeps old class names, services and console commands working. But it can't make an old class name equal the new one, bring back a removed setting, or put Craft 5's CSS back. Those are the places to check by hand.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does craft6-revamp fix any of this?
&lt;/h3&gt;

&lt;p&gt;No. It moves folders, config and environment variables, and it does that well. The issues here are in your code: templates, modules and plugins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Will PHPStan find all of them?
&lt;/h3&gt;

&lt;p&gt;It found the enum comparison and the leftover type hints. It won't find class names hidden in strings, and it says nothing about JavaScript or CSS. Use it together with a visual comparison and a click through the control panel with the browser console open.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I wait for Craft 6.0.0 before checking my site?
&lt;/h3&gt;

&lt;p&gt;You don't need to upgrade a live site during the beta. But looking for these issues now, in a copy of the site, is cheap, and it tells you how big the real upgrade will be.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://b10k.nl/blog/craft-6-silent-breaks/" rel="noopener noreferrer"&gt;b10k.nl&lt;/a&gt;. I'm Bohdan, a freelance Craft CMS developer in the Netherlands. Want to know what your site needs for Craft 6? Start with a &lt;a href="https://b10k.nl/craft-6/" rel="noopener noreferrer"&gt;Craft 6 readiness check&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>craftcms</category>
      <category>php</category>
      <category>laravel</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Upgrading Craft 3 to Craft 5: What Broke Wasn't Craft</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Thu, 19 Nov 2026 08:40:39 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/upgrading-craft-3-to-craft-5-what-broke-wasnt-craft-3kho</link>
      <guid>https://dev.to/bohdan_feniuk/upgrading-craft-3-to-craft-5-what-broke-wasnt-craft-3kho</guid>
      <description>&lt;p&gt;&lt;strong&gt;There's no direct path from Craft 3 to Craft 5 — and Craft was still the easy part.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This year I moved a Craft 3 site that had been running for years to Craft 5. It's a private portal where a company shares large media files with its clients: about 40,000 entries, 86,000 assets on Amazon S3, a handful of plugins and a custom one that builds zip downloads. The site had been through several agencies, and earlier attempts to upgrade it had stopped halfway.&lt;/p&gt;

&lt;p&gt;The Craft migrations did their job. Almost everything that broke was &lt;em&gt;around&lt;/em&gt; Craft: S3, file paths, permissions, licences and DNS. Here's what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check what the site runs on the server
&lt;/h2&gt;

&lt;p&gt;The first plan was to move to managed Craft hosting as part of the upgrade. That didn't work out: the site runs &lt;code&gt;ffmpeg&lt;/code&gt; on the server to process media, and the host didn't support it. We stayed on a plain VPS with a fresh setup.&lt;/p&gt;

&lt;p&gt;Before you choose hosting, write down every program the site runs on the server: ffmpeg, ImageMagick, Ghostscript, wkhtmltopdf.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two steps, three branches
&lt;/h2&gt;

&lt;p&gt;You can't jump from Craft 3 straight to 5. You have to go through Craft 4. So the project got three branches — &lt;code&gt;craft-3&lt;/code&gt;, &lt;code&gt;craft-4&lt;/code&gt; and &lt;code&gt;craft-5&lt;/code&gt; — each with its own code, &lt;code&gt;composer.lock&lt;/code&gt; and project config.&lt;/p&gt;

&lt;p&gt;The database migration ran locally in DDEV:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Import the production backup on the Craft 3 branch and run &lt;code&gt;craft up&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Switch to the Craft 4 branch, run &lt;code&gt;composer install&lt;/code&gt; and &lt;code&gt;craft up&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Do the same on the Craft 5 branch.&lt;/li&gt;
&lt;li&gt;Export the database and import it on the new server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Craft 3 project ran on PHP 7.4 and Craft 5 needs 8.2 or newer, so DDEV's PHP version changed between steps. The database version stayed the same. The new server never ran anything but Craft 5: it spent its first weeks as staging, reachable by IP, and on launch day it simply became production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do a test run on real data
&lt;/h2&gt;

&lt;p&gt;A month before launch we did the whole move on a fresh production backup and checked the result: entry, asset and user counts before and after, and whether the newest production entry made it across. Everything that surprised us went into a step-by-step list.&lt;/p&gt;

&lt;p&gt;On launch day we just followed that list. It took about an hour from the backup to a checked new server.&lt;/p&gt;

&lt;h2&gt;
  
  
  What broke
&lt;/h2&gt;

&lt;h3&gt;
  
  
  An S3 policy only Craft 5 noticed
&lt;/h3&gt;

&lt;p&gt;On Craft 5, every upload failed with &lt;code&gt;Unable to check if &amp;lt;file&amp;gt; exists&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The bucket policy had a &lt;code&gt;Deny s3:ListBucket&lt;/code&gt; rule for everyone, meant to stop the public from listing files. It also blocked the site's own IAM user. Without that permission, S3 answers a check for a missing file with 403 instead of 404.&lt;/p&gt;

&lt;p&gt;Craft 3 (Flysystem v1) quietly read that 403 as "the file doesn't exist". Craft 5 (Flysystem v3) throws an error. Same bucket, same policy — it just never mattered before.&lt;/p&gt;

&lt;p&gt;The fix was one condition on the Deny rule that makes an exception for the site's IAM user (&lt;code&gt;ArnNotEquals&lt;/code&gt; on &lt;code&gt;aws:PrincipalArn&lt;/code&gt;). The public still can't list the bucket. The test run caught this. Without it, uploads would have broken on launch day.&lt;/p&gt;

&lt;h3&gt;
  
  
  Missing UIDs: don't make up new ones
&lt;/h3&gt;

&lt;p&gt;Craft 5's content migration stopped on 49 field layout tabs and elements that had no UID. Craft 5 stores content as JSON, with those UIDs as the keys, so it needs them.&lt;/p&gt;

&lt;p&gt;The usual quick fix is a script that generates random UIDs. Here that would have gone badly, and nobody would have noticed at first: the Craft 5 project config already had its own UIDs for those elements. With random ones, the content would point at nothing. No error — it would just be gone from the control panel and the site.&lt;/p&gt;

&lt;p&gt;So we looked up each missing UID in the Craft 5 project config and committed them to the Craft 4 branch. A normal &lt;code&gt;craft up&lt;/code&gt; on Craft 4 then wrote the right UIDs before the Craft 5 migration ran. Over 154,000 content values moved, none lost. (A different UID problem, duplicates, came up in my &lt;a href="https://b10k.nl/blog/craft-4-to-5-upgrade/" rel="noopener noreferrer"&gt;Craft 4 to 5 upgrade&lt;/a&gt;.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Small renames that break quietly
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ENVIRONMENT&lt;/code&gt; is now &lt;code&gt;CRAFT_ENVIRONMENT&lt;/code&gt;.&lt;/strong&gt; Craft 3-era &lt;code&gt;.env&lt;/code&gt; files use the old name. Craft 4 and 5 don't see it and assume production — locally that made project config read-only, with no explanation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Super Table fields are now queries.&lt;/strong&gt; A template that read &lt;code&gt;asset.technicalSpecs.resolution&lt;/code&gt; now needs &lt;code&gt;asset.technicalSpecs.one().resolution&lt;/code&gt;. Search your templates for every Super Table and Matrix field used like a single object.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Files written where they can't be
&lt;/h3&gt;

&lt;p&gt;The new server deploys in releases: every deploy replaces the project folder, and PHP can't write to it. That's how three old problems showed up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the zip plugin wrote to a relative path that ended up inside &lt;code&gt;web/&lt;/code&gt; — moved to Craft's temp folder;&lt;/li&gt;
&lt;li&gt;generated media previews were saved under the project root — moved to &lt;code&gt;storage/&lt;/code&gt;, which is shared between releases;&lt;/li&gt;
&lt;li&gt;a filesystem in project config had absolute paths from the old server — replaced with &lt;code&gt;@webroot&lt;/code&gt; and &lt;code&gt;@web&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A nice bonus: those previews had never actually been saved on the old server, so pages got faster after the upgrade.&lt;/p&gt;

&lt;p&gt;After one deploy, every control panel page returned a 500. Craft rewrites the project config YAML files, and they belonged to the deploy user, not the PHP user. Putting both users in one group and letting that group write to the folder (with the setgid bit) fixed it. Check this before you run &lt;code&gt;craft up&lt;/code&gt; on launch day.&lt;/p&gt;

&lt;h3&gt;
  
  
  A licence banner that came with the real domain
&lt;/h3&gt;

&lt;p&gt;On staging, a trial plugin showed a small "trial" notice. As soon as the site ran on its real domain, Craft saw it as production and put a red "Purchase required" banner across the control panel. The plugin turned out to be unused, so we removed it before the DNS switch.&lt;/p&gt;

&lt;p&gt;Test the control panel on the real hostname before launch — the &lt;code&gt;/etc/hosts&lt;/code&gt; trick below does exactly that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update Craft 5 once more before launch
&lt;/h3&gt;

&lt;p&gt;Our test run was on Craft 5.9, and by launch day that version had known security issues. So we updated to the latest 5.x and ran &lt;code&gt;composer audit&lt;/code&gt; before going live, not after.&lt;/p&gt;

&lt;p&gt;An upgrade is also a good moment to delete things. We removed a public &lt;code&gt;phpinfo()&lt;/code&gt; file, an IIS &lt;code&gt;web.config&lt;/code&gt; on an nginx server, a forgotten folder in the web root, and Redactor, replaced by CKEditor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Switching DNS you don't control
&lt;/h2&gt;

&lt;p&gt;The domain's DNS was managed by someone else, and every change was an email. Here's how we kept the switch calm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copy the TLS certificate&lt;/strong&gt; from the old server ahead of time, so HTTPS works the moment DNS changes. Set up automatic renewal on the new server afterwards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the real domain before DNS changes.&lt;/strong&gt; Add &lt;code&gt;&amp;lt;new IP&amp;gt; &amp;lt;domain&amp;gt;&lt;/code&gt; to &lt;code&gt;/etc/hosts&lt;/code&gt; on your own machine and open the site in a private window. You see the real hostname, certificate and URLs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Freeze only the control panel.&lt;/strong&gt; Only staff add content; clients just view and download. So the public site stayed up on the old server until DNS moved, and visitors had no downtime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep a way back:&lt;/strong&gt; a DDEV snapshot, a backup of the new server's staging database, and the old server running for a week or two.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A checklist for your Craft 3 → 5 upgrade
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Go through Craft 4&lt;/strong&gt;, one branch per version, and migrate locally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write down the programs the site runs on the server&lt;/strong&gt; before you choose hosting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do a test run on a fresh production backup&lt;/strong&gt; and write down every step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check counts and the newest entry&lt;/strong&gt; after every run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fill missing UIDs from your project config&lt;/strong&gt;, never with random values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Review S3 bucket policies, file paths and folder permissions.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the control panel on the real domain&lt;/strong&gt; through &lt;code&gt;/etc/hosts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update to the latest Craft 5 and run &lt;code&gt;composer audit&lt;/code&gt;&lt;/strong&gt; before launch.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I upgrade from Craft 3 straight to Craft 5?
&lt;/h3&gt;

&lt;p&gt;No. You have to go through Craft 4 first. Run each version's migrations in order, ideally locally on a copy of the production database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why do uploads fail with "Unable to check if file exists" after upgrading to Craft 5?
&lt;/h3&gt;

&lt;p&gt;Often it's the S3 bucket policy. If the site's own user isn't allowed to list the bucket, S3 answers 403 instead of 404 for a missing file. Craft 3 ignored that; Craft 5 doesn't. Make sure the policy doesn't deny &lt;code&gt;s3:ListBucket&lt;/code&gt; to the site's IAM user.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I fix "Field layout element is missing its UUID"?
&lt;/h3&gt;

&lt;p&gt;Add the missing UIDs on Craft 4, before the Craft 5 migration runs. If you already have a Craft 5 project config, take the UIDs from there instead of generating random ones — otherwise content can quietly disappear.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://b10k.nl/blog/craft-3-to-5-upgrade/" rel="noopener noreferrer"&gt;b10k.nl&lt;/a&gt;. I'm Bohdan, a freelance Craft CMS developer in the Netherlands. Planning the next step? Here's how I help with the &lt;a href="https://b10k.nl/craft-6/" rel="noopener noreferrer"&gt;move to Craft 6&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>craftcms</category>
      <category>php</category>
      <category>aws</category>
      <category>webdev</category>
    </item>
    <item>
      <title>When Rolling Back a Deploy Doesn't Help</title>
      <dc:creator>Bohdan Feniuk</dc:creator>
      <pubDate>Sun, 15 Nov 2026 10:02:19 +0000</pubDate>
      <link>https://dev.to/bohdan_feniuk/when-rolling-back-a-deploy-doesnt-help-3ffp</link>
      <guid>https://dev.to/bohdan_feniuk/when-rolling-back-a-deploy-doesnt-help-3ffp</guid>
      <description>&lt;p&gt;&lt;strong&gt;The deploy wasn't the problem. Rolling back proved it — and restoring the database made things worse.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When production goes down right after a deployment, rolling back feels like the safest move. Put back what worked, get the sites up, investigate later. Most of the time that's right. This time it wasn't, and the logs showed why.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened
&lt;/h2&gt;

&lt;p&gt;I deployed an update to six websites running on &lt;a href="https://servd.host" rel="noopener noreferrer"&gt;Servd&lt;/a&gt;, all powered by a single Craft CMS installation. The changes had been tested and approved on staging.&lt;/p&gt;

&lt;p&gt;A few minutes after the deploy, the sites started returning errors and timing out.&lt;/p&gt;

&lt;p&gt;My first thought was to roll back. I expected it to take a few minutes: get the sites running again, then find out what went wrong. I asked Servd for the logs, rolled back the code, and restored the database from the backup taken just before the deploy.&lt;/p&gt;

&lt;p&gt;Rolling back the code didn't help.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the logs showed
&lt;/h2&gt;

&lt;p&gt;When the logs came in, they told a different story from the one I'd assumed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The old code failed in exactly the same way.&lt;/strong&gt; After the rollback, requests averaged 46 seconds, and some hit the 120-second timeout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The caches were empty.&lt;/strong&gt; Craft clears its own caches on every deploy, and I had also cleared the full page cache myself, as I usually do. Every visitor and every bot was asking for an uncached page at the same moment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The server was already near its limit.&lt;/strong&gt; Load had been high all day, well before the deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What brought the sites back wasn't me.&lt;/strong&gt; Servd's automatic protection switched on its "Under Attack" mode, filtered out bot traffic and restarted PHP. Within a minute everything was running again — before my database restore had even started.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem was already there. The deployment only triggered it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a deploy can tip a busy server over
&lt;/h2&gt;

&lt;p&gt;On a warm site, most requests never reach Craft's heavy work: pages, queries and template fragments come out of a cache. Right after a deploy that cache is empty. Every request now does the full work — for real visitors, and for every crawler that happens to be on the site.&lt;/p&gt;

&lt;p&gt;Six sites on one installation share one server. If that server is already busy, a minute of cold caches across all six is enough to queue requests until they time out. And a rollback brings the old code back with the same empty caches, so it fails the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rolling back code vs restoring the database
&lt;/h2&gt;

&lt;p&gt;These two feel like one action. They aren't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rolling back code&lt;/strong&gt; is cheap and reversible. If the old code works and the new one doesn't, you've learned something in minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Restoring the database&lt;/strong&gt; is heavier. It replaces the live data with a snapshot, and the application has to rebuild everything it had cached from the data that's now gone. Here it caused another 16 minutes of errors, and the sites only recovered after I cleared Craft's data cache.&lt;/p&gt;

&lt;p&gt;There is one case where a restore belongs in the rollback: when the release ran migrations that the old code can't work with. Then old code and new database don't fit together. If the release didn't change the schema — or the old code already fails the same way — the restore only adds risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same release, the next morning
&lt;/h2&gt;

&lt;p&gt;The next morning I deployed exactly the same release again, unchanged. Two things were different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I switched on bot protection &lt;strong&gt;before&lt;/strong&gt; the deploy.&lt;/li&gt;
&lt;li&gt;I left the full page cache alone and let pages refresh on their own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It went smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do differently now
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Check the server's load before deploying&lt;/strong&gt;, not only that staging works. A server close to its limit is one cold cache away from going down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn on bot protection before deploying&lt;/strong&gt; busy sites, so crawlers don't arrive first at an empty cache.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't clear the full page cache out of habit.&lt;/strong&gt; Let it refresh, unless the release actually changes what cached pages should show.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look at the logs before assuming the new code is broken.&lt;/strong&gt; If response times were already climbing before the deploy, or the old code fails the same way, it's not the code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat a database restore as a separate decision.&lt;/strong&gt; Roll back code first. Restore data only if the release changed the schema in a way the old code can't handle.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Looking back, I still think rolling back was a reasonable first reaction. Restoring the database wasn't necessary, and it cost us more downtime. Next time I'll still consider rolling back first — but I'll think twice before touching the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Should I restore the database when I roll back a deploy?
&lt;/h3&gt;

&lt;p&gt;Usually not. Roll back the code first. Restore the database only if the release changed it in a way the old code can't work with. Otherwise a restore just adds downtime — here it added 16 minutes of errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why can a site go down right after a deploy that worked on staging?
&lt;/h3&gt;

&lt;p&gt;A deploy empties the caches, so every visitor and every bot makes the server do the full work at the same time. If the server was already busy, that alone can make it time out, even when the new code is fine.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://b10k.nl/blog/rollback-did-not-help/" rel="noopener noreferrer"&gt;b10k.nl&lt;/a&gt;. I'm Bohdan, a freelance Craft CMS developer in the Netherlands — I build and &lt;a href="https://b10k.nl/maintenance/" rel="noopener noreferrer"&gt;maintain Craft sites&lt;/a&gt; and write &lt;a href="https://b10k.nl/plugins/" rel="noopener noreferrer"&gt;Craft plugins&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>webdev</category>
      <category>php</category>
      <category>craftcms</category>
    </item>
  </channel>
</rss>
