Enqueue Hooks: Four Hooks, Four Different Zones — and How Not to Mix Them Up
On the surface, these five hooks all do the same thing — load CSS/JS. But four of them sound almost identical while each one runs in a different…

Action Hook since 5.0.0
Loads scripts/styles inside the block editor only
enqueue_block_editor_assets is the block-editor-only counterpart to wp_enqueue_scripts — it never runs on the public front-end.
wp-admin post editor and site editor screens only, when the block editor initializes. Does not run on the public front-end.
do_action( 'enqueue_block_editor_assets' );add_action( 'enqueue_block_editor_assets', function() {
wp_enqueue_script(
'my-block-editor-script',
get_template_directory_uri() . '/js/editor.js',
[ 'wp-blocks', 'wp-element', 'wp-editor' ],
'1.0'
);
} );Load a custom block's JS registration file, editor-only.
add_action( 'enqueue_block_editor_assets', function() {
if ( 'post' !== get_current_screen()->post_type ) {
return;
}
wp_enqueue_script( 'my-post-only-sidebar', get_template_directory_uri() . '/js/sidebar.js' );
} );Load a sidebar plugin script only on the Post editor, not other post types or the site editor.

On the surface, these five hooks all do the same thing — load CSS/JS. But four of them sound almost identical while each one runs in a different…
No — this hook is editor-only, even in a block theme. For assets needed both in the editor and on the front-end (e.g. a block's own styling), use enqueue_block_assets instead.
Source: wp-includes/script-loader.php
One session: this hook, then each related_hooks entry. Walk it and tell us what to change.
enqueue_block_editor_assets → wp_enqueue_scripts → enqueue_block_assets
Practice the enqueue_block_editor_assets WordPress action hook in our interactive sandbox — a VS Code-style editor with a step-by-step enqueue_block_editor_assets tutorial, add_action exercises, and instant feedback. No local WordPress install required.