load-<page_hook>

Fires before a particular screen is loaded.

Description

do_action( 'load-<page_hook>' ); 

The load-* hook fires in a number of contexts. This hook is for plugin screens where a callback is provided when the screen is registered.

The dynamic portion(s) of the hook name refer to a mixture of plugin page information including: 1. The page type. If the plugin page is registered as a submenu page, such as for 2. A separator of _page_. 3. The plugin basename minus the file extension.

Together, the three parts form the $page_hook. Citing the example above, the hook name used would be load-settings_page_pluginbasename.


Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'load-{$page_hook}' ); 
The following example is for adding a hook callback.
  1. // define the load-<page_hook> callback 
  2. function action_load_page_hook( ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( "load-{$page_hook}", 'action_load_page_hook', 10, 0 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "load-{$page_hook}", 'action_load_page_hook', 10, 0 ); 

Defined (1)

The action is defined in the following location(s).

/wp-admin/admin.php  
  1. do_action( "load-{$page_hook}" );