admin_enqueue_scripts WordPress Action Hook

The admin_enqueue_scripts hook is used to load scripts and styles on the admin side of WordPress. This hook is used by WordPress core, plugins, and themes to load their scripts and styles.

do_action( 'admin_enqueue_scripts', string $hook_suffix ) #

Enqueue scripts for all admin pages.


Parameters

$hook_suffix

(string)The current admin page.


Top ↑

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.


Top ↑

Source

File: wp-admin/admin-header.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.