Ask the Bartender: How To Bulk Convert Classic WordPress Posts To Blocks?

I was wondering if you could help me. I want to convert all of my old posts (about 600) to Gutenberg blocks. Do you know an easy way to do that?

Philip

I often get these short questions via private messages. I always try my best to help other WordPress users whenever I can. This was an easy solution in Philip’s case. After a quick chat, he actually learned that he did not need to migrate his posts to the block system. I thought it would be best to open this topic to a wider audience. Maybe it would help someone else along the way.

There is currently an open ticket on the Gutenberg repository for a bulk converter. It has sat dormant until a few days ago. The primary argument for including this feature in the plugin and eventually WordPress itself is that the lack of this option is an obstacle for newcomers to the block editor.

I disagree with the notion that it is any sort of obstacle for block-editor adoption. There does not seem to be a massive call for the feature in the WordPress support forums. Web searches do not pull up too many support queries for it. It seems to be a niche use case. Or, in some cases, there is a simple misunderstanding that end-users need to do any sort of conversion or migration at all.

However, the biggest reason it is a non-obstacle is that posts written in the classic editor are still basic HTML. Regardless of the editor, older content will output just fine on the front end, at least in most cases.

The first question anyone should ask before deciding on bulk converting their old posts to the newer block format is whether they should do it at all. The answer for the majority of users will simply be no. There are few reasons to do so.

Doing a mass conversion like this, especially with hundreds or more posts, is subject to broken sites. I have done enough single-post updates to know that the process does not always go smoothly. Sometimes, I need to touch up something here or do some manual changes there. On a large scale, there really is no way to know what got broken until you test every single post or page on the site. In some cases, everything is OK. In others, it is a nightmare.

If you are thinking of going down the bulk-conversion route, make a backup first. There is a good chance that you will need it. You should also test this on a staging site.

My recommendation for most users is to convert posts on an as-needed basis. I like to make the switch any time I edit an old post. The only reason I convert them is that I prefer working with the block editor over classic.

Posts written in the old editor will be in the Classic block. After selecting the block that houses the content, I hit the “Convert to blocks” button in the block toolbar. I do a quick check of anything that might need to be fixed before hitting the update button.

Classic block in the editor with the "Convert to blocks" button highlighted.
“Convert to blocks” button for the Classic block.

In most cases, there is no reason to convert old posts to blocks except when you are actually editing those posts.

Despite claims that things will “just work” when switching to the block editor, that is not the day-to-day reality of all WordPress users. Some of the biggest reasons I have seen to bulk convert are around theme design issues. For example, the block system made some fundamental changes to image markup. If your theme handles left and right-aligned images added via the block editor but breaks down on your old posts, bulk converting may be an option. However, the first course of action should be checking in with your theme author about adding support for the classic markup.

There are likely numerous other edge cases. Bulk converting posts is an invasive operation that can only be reverted by restoring a pre-conversion backup. It should be a last resort.

If you are at the point where you know you need to convert all your old posts, there are a few options available.

The Bulk Block Converter plugin is likely the most-used solution at the moment. Organic Themes released it a little over a year ago but has only updated it once. User reviews have been mixed. A few of the problems seemingly stem from WordPress — the plugin extends the core WordPress block converter used in single posts.

For those with clients who want to find a middle ground between bulk conversion and having the client manually convert their old posts, 10up’s Convert to Blocks plugin might be the right solution. It converts posts on the fly, only making changes when a user opens the post-editing screen.

Fränk Klein is also working on a PHP-based bulk converter plugin named Bulk Convert to Blocks. It is currently in the development stage and not ready for use on live sites. It offers a screen in the WordPress admin to perform the conversion and will continue working in the background if the user leaves the page. Because it runs via PHP, developers can extend it with custom actions and filters. It also provides a WP CLI command for those who prefer to work from the command line.

4

4 responses to “Ask the Bartender: How To Bulk Convert Classic WordPress Posts To Blocks?”

  1. I am sorry for the slight off topic, but does anyone know where the categories “After WordPress 5.x” and “Future” went from the Gutenberg GitHub’s repository. I am asking this because there were some cool ideas and I can’t find them anymore. Were these categories deleted?

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.