Bulk/Mass convert Classic Editor WordPress post to Blocks Editor posts while keeping database sanity.
The goal is to covert thousands of posts with a minimal impact on the database,
and an under-control impact on the hosting server ressources.
No additional row will be set, only post_content
cell for all non-null classic
published posts will be updated.
This tool is targeting power users or admin who want to reduce database
alterations at the minimum while converting old posts to WordPress Blocks posts.
After last validation, changes are not reversible (not to say destructive).
If a more user-friendly with a graphical interface is wanted (and is more important than database sanity), please have a look at the Bulk Block Converter plugin.
As always, backup your database before.
- Install the Basic Authentication handler plugin
- See why in the FAQ
- Download runner
- Docker image
docker run ghcr.io/leocolomb/wp-classic-to-blocks
- NPM package
npx wp-classic-to-blocks
- Docker image
- Database information will be asked
- Host
- Database name
- Username
- Password
- WordPress Table Prefix
- WordPress REST-API information will be asked
- Base URL (e.g.
https://my-wp.domain
) - Optional IP address to bypass DNS resolution
- Optional insecure certificate validation
- Precessing confirmation will be asked
Returns a promise for generating database interface.
Type: Object
Database connection information.
Type: String
Default: wp_
Database tables prefix.
Returns a promise for generating WordPress REST-API interface.
Type: Object
Type: String
Base URL to the WordPress site.
Type: String
Username to connect to the API.
Type: String
Password to connect to the API.
Type: String?
Default: null
IPv4 address to resolve the domain name provided in the base URL.
Type: Boolean
Default: false
Disable certificate validation.
Type: Object
Default: {}
Returns a promise for generating a classic to block content raw-handler.
Since WordPress Blocks environment is written in JavaScript and targets browsers, the best server-side emulation is Node.js.
The only way to register blocks
used for conversion uses matchMedia
function, which is not available on Node.js environment, as expected.
In order to let the WordPress Blocks raw handler
handle the post content, the data provided has to be HTML rendered using
the_content
filter
under edit
(editor) context.
Since WordPress REST-API does not support authentification (seriously), we need to the non-official official authentification public to get rendered content.
WordPress makes things complicated for developers, sometimes. And WordPress/gutenberg#12694.
ISC © Léo Colombaro