0
votes

When you have a classic block in Wordpress and want to convert it to Gutenberg blocks you have the option to go to Settings > Convert to blocks.

Example: https://imgur.com/RuOflNw

For a project I have disabled the standard blocks and made my own. Is it possible to convert to these blocks instead? And how?

Many thanks in advance!

Pat

1

1 Answers

0
votes

As per my knowledge no, gutenberg must have some kind of internal functionality to convert basic content to some pre-defined blocks, if any of the content element deviate from basic content then it will not convert that to block and here you need to add support. You can debug into their source code to find that logic because docs are not good but I think it will be a heck of work and your solution will only work if there is any hook to add your functionality.

On side note Gutenberg blocks does provide the transform method in their registerBlockType function which helps you transform your block to other blocks e.g you can convert quote block to paragraph provided that your current block is valid.