I'm using register_block_type to register my blocks.

I'm not sure what is the best hook to use, between init and enqueue_block_editor_assets.

I suppose that enqueue_block_editor_assets it is loaded after, because I can use get_the_ID

What are the pro and cons of both?

1 Answer 1


In the developer docs they've always used the init hook and it's always worked for me.

Extracted from that source:

function create_block_gutenpride_block_init() {
    register_block_type( __DIR__ . '/build' );
add_action( 'init', 'create_block_gutenpride_block_init' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.