Choose a WordPress enqueue hook by where an asset should appear: use wp_enqueue_scripts for the public site, admin_enqueue_scripts for dashboard pages, login_enqueue_scripts for login screens, and enqueue_block_assets for assets shared by blocks on the front end and in the editor. For the block editor interface alone, use the separate enqueue_block_editor_assets hook.
Which WordPress enqueue hook should you use?
| Hook | Where the asset belongs | Typical audience | Scope |
|---|---|---|---|
wp_enqueue_scripts |
Public front end | Site visitors | Front-end scripts and styles |
admin_enqueue_scripts |
Administration screens | Site administrators and other dashboard users | Admin scripts and styles; can be narrowed to a screen using its hook suffix |
login_enqueue_scripts |
Login and registration screens | People authenticating or registering | Login-area scripts and styles |
enqueue_block_assets |
Block content on the front end and in the editor | Site visitors and content editors | Shared block assets |
enqueue_block_editor_assets |
Block editor interface | Content editors | Editing-interface assets only |
The first four hooks are the four broad destination zones. The fifth is important because its name resembles the shared block hook, but its destination is different.
As an Amazon Associate I earn from qualifying purchases.
Use the hook for the public site
Register front-end scripts and styles on wp_enqueue_scripts. Despite the word “scripts,” the action is also the correct place to enqueue styles intended for the public-facing site. WordPress Developer Resources calls it the proper hook for scripts and styles meant to appear on the front end: wp_enqueue_scripts hook reference.
The wp_enqueue_scripts() function is a wrapper for that action. It runs first in wp_head(), when conditional checks such as is_home() and is_page() are available. That makes the hook suitable for loading an asset only on relevant front-end requests, rather than across every public page. See the function reference.
#1 Best Overall
Use the admin hook, then narrow it to the right screen
For dashboard-only scripts or styles, use admin_enqueue_scripts. It handles styles as well as scripts, and its callback receives the current admin page’s hook suffix. Check that value when an asset is needed on just one screen; otherwise, it may load throughout the administration area. WordPress documents the action and its suffix parameter in the admin_enqueue_scripts reference.
For example, the callback can accept the suffix and return early on screens that should not receive the asset:
Rank #2
add_action( 'admin_enqueue_scripts', 'my_admin_assets' );
function my_admin_assets( $hook_suffix ) {
if ( 'toplevel_page_example' !== $hook_suffix ) {
return;
}
wp_enqueue_style(
'my-admin-style',
plugin_dir_url( __FILE__ ) . 'admin.css'
);
}
Replace toplevel_page_example with the suffix for the intended screen. The specific suffix depends on the page being targeted; do not assume this example value matches a plugin or site’s screen.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Use the login hook for login and registration screens
Use login_enqueue_scripts for assets meant for the WordPress login area, including styles. The hook reference describes it as the proper action for items intended for the login page: login_enqueue_scripts.
Rank #3
This keeps authentication-screen assets separate from both public-site assets and dashboard assets. A login-page stylesheet does not belong on wp_enqueue_scripts merely because visitors can see that page, nor on admin_enqueue_scripts just because it is part of WordPress.
Choose between the two block hooks by destination
Shared block assets: enqueue_block_assets
Use enqueue_block_assets when an asset belongs to block content in both the front end and the editor. Since WordPress 6.3, assets added through this action are also enqueued for the editor iframe. The behavior and version note are in the enqueue_block_assets reference.
Rank #4
If a block style should be available only in the editor, the hook reference gives an is_admin() example for restricting it. This is useful when shared block styling would otherwise affect the public site but the desired asset is editor-only.
Editor interface assets: enqueue_block_editor_assets
Use enqueue_block_editor_assets for assets of the block editing interface itself, not for styling block content shared with the public site. The distinction is documented in the enqueue_block_editor_assets reference.
Best Value
Keep assets out of unrelated screens
For each asset, identify its actual destination before choosing a hook. A script needed by public pages should not be attached to an admin action; a dashboard control should not load for visitors; and login-specific CSS should stay on the login path. The wp_enqueue_script() reference recommends using the matching front-end, admin, or login action and warns that enqueuing on all admin screens can cause conflicts or degrade the administration experience: wp_enqueue_script function reference.
Quick Recap
- Public pages:
wp_enqueue_scripts. - Dashboard pages:
admin_enqueue_scripts, narrowed by the page suffix when appropriate. - Login or registration:
login_enqueue_scripts. - Block content in both editor and front end:
enqueue_block_assets. - Block editor interface only:
enqueue_block_editor_assets.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




