Difference between register_block_type & wp.blocks.registerBlockType


I am creating a plugin that is supposed to add custom blocks to Gutenberg. I have registered and built all my blocks using WordPress’s JavaScript function wp.blocks.registerBlockType(). It works just as I expected, but recently I found out that WordPress also has a PHP function called register_block_type().

The documentation says register_block_type() “registers a block type”.. It uses the WP_Block_Type_Registry class, but I don’t really understand what the class does.

Anyone could help me understand what register_block_type() does exactly and what is the difference with wp.blocks.registerBlockType()?

Thanks for your help!

Simon Lac 4 months 0 Answers 14 views 0

Leave an answer