W3cubDocs

/WordPress

do_action( ‘admin_enqueue_scripts’, string $hook_suffix )

Fires when enqueuing scripts for all admin pages.

Parameters

$hook_suffixstring
The current admin page.

More Information

admin_enqueue_scripts is the proper hook to use when enqueuing scripts and styles that are meant to be used in the administration panel. Despite the name, it is used for enqueuing both scripts and styles.

It provides a single parameter, $hook_suffix, that informs the current admin page. This should be used to enqueue scripts and styles only in the pages they are going to be used, and avoid adding script and styles to all admin dashboard unnecessarily.

Source

do_action( 'admin_enqueue_scripts', $hook_suffix );

Changelog

Version Description
2.8.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts