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