I am creating a plugin, which adds a number of blocks defined by JS/PHP as per Gutenberg documentation. I want to display these block names on an admin page.

Is there a hook or function I can use which will let me know which blocks are being defined in my plugin from the register_block_type function, or will I have to create list and update it manually?

I am currently looping through the below and looking for my my-block/in the list and then displaying, is there a better or more accurate way?

$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.