Page load hooks in the WordPress admin area

There are a number of really handy hooks, each of which are specific to a page in the WordPress admin area. You can use these action hooks to enqueue scripts on particular pages, to process form requests, etc, etc.

Despite these hooks being so handy, and despite using them a great deal, every time I want to use one I have to dig through the code to try and work out how they work and what they’re called… so for my own benefit, here’s what I think is a complete list:

  • load-[URL basename (i.e. with extension)] - e.g.load-profile.php,load-index.php, etc. These hooks exist on all main admin pages and are called before the admin-header.php file has loaded.
  • load-[URL filename (without extension)]_page_[page GET parameter from URL] – e.g.load-tools_page_featured-bloggers (plugin generated Tools options page with the file parameter of “featured-bloggers”, see the codex page on Adding Administration Menus for more information on adding menus and pages). These hooks are called before the admin-header.php file has been loaded.
  • [URL filename (without extension)]_page_[page GET parameter from URL] – e.g.tools_page_featured-bloggers (plugin generated Tools options page with the file parameter of “featured-bloggers”, see the codex page on Adding Administration Menus for more information on adding menus and pages). These hooks are called after the admin-header.php file has been loaded.

There. Hopefully next time I need the hooks I’ll remember I’ve written this handy reference.

One thought on “Page load hooks in the WordPress admin area

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>