get_header

Fires before the header template file is loaded.

Description

do_action( 'get_header', (string) $name ); 

The hook allows a specific header template file to be used in place of the default header template file. If your file is called header-new.php, you would specify the filename in the hook as get_header( new ).

Parameters (1)

0. $name (string)
Name of the specific header file to use.

Usage

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

Defined (1)

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

/wp-includes/general-template.php  
  1. do_action( 'get_header', $name );