do_action( "admin_head-{$hook_suffix}" )

Fires in head section for a specific admin page.

Description Description

The dynamic portion of the hook, $hook_suffix, refers to the hook suffix for the admin page.

Top ↑

More Information More Information

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn’t return, and shouldn’t take any parameters.

Top ↑

Source Source

File: wp-admin/admin-header.php

View on Trac

Top ↑

Changelog Changelog

Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Akira Tachibana

    (From Codex)
    Tools pages

    To add <head></head> content to a management page, the suffix for this hook should be in the following form:

    add_action('admin_head-tools_page_myplugin/myplugin', 'myplugin_adminhead');
    function myplugin_adminhead() {
        // Output <head> content here, e.g.:
        echo '<style type="text/css">'
             .'/* ... */'
  2. Skip to note 2 content
    Contributed by Akira Tachibana

    (From Codex)
    Options pages

    This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this:

    add_action( 'admin_menu', 'myplugin_setup_options' );
    function myplugin_setup_options(){
      $plugin_page=add_options_page( 'My Plugin', 'myplugin', 8, basename(__FILE__), 'myplugin_main' );
      add_action( 'admin_head-'. $plugin_page, 'myplugin_admin_header' );
    function myplugin_admin_header(){
      echo '<p>Only executes when the myplugin options page is displayed.</p>';

Top ↑

You must log in before being able to contribute a note or feedback.