Craft 3 reached end of life on April 30, 2024. A site still running it has had no security fixes for well over two years, and it’s now two major versions behind, with a third on the way.
The first question people ask is whether they can skip a version. You can’t. The Craft 5 upgrade guide says it plainly: there’s no direct upgrade from Craft 3 to Craft 5. It’s 3 to 4, then 4 to 5, in that order.
That sounds like twice the work. In practice it’s one project with a checkpoint in the middle, and the checkpoint is useful.
Before Anything Else
Take a copy of the live database and work on that, locally. None of this should happen on the server.
Then bring Craft 3 itself up to date. Both hops start from the latest release of the version you’re leaving, with every plugin updated as well. A site on 3.4 goes to the last 3.x release before it goes anywhere near 4.
Once it’s there, open Utilities, then Deprecation Warnings. That’s the list of old code your templates and plugins are still calling. Fix everything on it. Each warning is something that will be an error in Craft 4.
Audit the Plugins First
Plugins are what make a Craft 3 site hard to move, and a site this old usually has a few that were abandoned along the way. For each plugin you need a version for Craft 4 and a version for Craft 5. If either is missing, you need a plan for replacing it.
Do this before you quote the job or promise a date. Two plugins come up again and again.
Redactor was the standard rich text editor on Craft 3. Its replacement is CKEditor, and there’s a command to convert the fields.
Super Table gave you nested, repeating fields. Craft 5 does the same thing natively, because Matrix blocks became nested entries. Those fields get converted to native Matrix and the plugin is removed.
Both conversions are easier to do on Craft 5 than to carry forward, which shapes the order of the work.
Hop One, Craft 3 to 4
Craft 4 needs PHP 8.0.2 or newer, and MySQL 5.7.8, MariaDB 10.2.7 or PostgreSQL 10. A server that’s been running Craft 3 untouched may be older than that, so check it first.
Then it’s a Composer update and the migrations.
composer update
php craft migrate/allThe changes that catch templates out are mostly from Twig 3, which Craft 4 moved to.
- The
spacelesstag is gone. Use thespacelessfilter, or just delete it. - You can’t put an
ifon aforloop any more. Filter the array before the loop. - Config settings like
siteNameandsiteUrlwere removed. They live in the control panel now. - Asset volumes were split into volumes and filesystems, and a
volumes.phpconfig file is no longer supported.
The upgrade checks some of your code and not all of it. Templates and modules need reading through by a person.
Stop at Craft 4 and Test
This is the checkpoint. Take a database snapshot, then test the site as though you meant to launch it on Craft 4. Click through the templates. Submit the forms. Save an entry of every type.
You won’t launch it. Craft 4 went end of life itself on April 30, 2026. But a problem found here has one cause. Find the same problem after the next hop and you won’t know which upgrade introduced it.
Hop Two, Craft 4 to 5
Craft 5 needs PHP 8.2 and MySQL 8.0.17, MariaDB 10.4.6 or PostgreSQL 13. For a site coming from Craft 3, that’s often a second server change.
The upgrade has a few more steps than the last one. The Craft 5 guide lists them in full, and these are the main ones.
php craft project-config/rebuild
php craft utils/fix-field-layout-uids
composer update
php craft upOn MySQL there’s also a character set conversion to run afterwards with php craft db/convert-charset.
The changes here go deeper than in Craft 4.
- Matrix blocks became nested entries.
craft.matrixBlocks()is gone, and any code that relied on block type IDs needs looking at. - The content table is gone. Field content is stored as JSON alongside each element.
- GraphQL type names changed. Anything on the front end that queries the API needs its queries updated.
- Custom field queries on MySQL became case-sensitive.
That second item is the one to respect. Moving every piece of content into a new storage format is where things can go missing.
Check Nothing Went Missing
I learned this on a Craft 4 to 5 upgrade. The migration finished without a single error, and every one of 571 calendar events had come through with an empty title and no content. Craft had migrated its own entries perfectly. It had no way to migrate elements that belonged to a plugin.
Nothing warned me. The calendar pages loaded. I only found it because I’d exported every title and field from the old database before starting, and compared the new database against that list at the end.
Do the same on a Craft 3 upgrade, and do it before the first hop. Two migrations give that kind of loss two chances to happen.
Then Tidy Up
With the site on Craft 5, convert Redactor fields to CKEditor and Super Table fields to native Matrix, then remove both plugins. Craft 5.3 added commands for merging duplicate fields and entry types, which are worth running on a site that’s collected a few over the years.
Ship the Database
For launch, I don’t run any of this on the production server. I pull a fresh copy of the live database, run the whole sequence locally, check the content, and restore the finished database on the server alongside the new code. The live site only ever meets the end result.
Rehearse that on staging first. A script that takes a site through two major versions will have bugs in it, and staging is the cheap place to find them.
And Craft 6?
Craft 6 is in beta, with the stable release planned for March. It can only be reached from Craft 5. So a Craft 3 site isn’t two versions behind for much longer. It’s about to be three.
Getting to Craft 5 is the whole job for now. It has security support for years, and it’s the starting line for whatever comes next.
Leave a Reply