string|null $name, array $args )
Fires before the header template file is loaded.
Name of the specific header file to use. Null for the default header.
Additional arguments passed to the header template.
get_header is a hook that gets run at the very start of the
get_header function call. If you pass in the name for a specific header file into the function
get_header( 'new' ), the
do_action will pass in the same name as a parameter for the hook. This allows you to limit your
add_action calls to specific templates if you wish. Actions added to this hook should be added to your functions.php file.
Note: This hook is best to use to set up and execute code that doesn’t get echoed to the browser until later in the page load. Anything you echo will show up before any of the markups is displayed.
View all references
do_action( 'get_header', $name, $args );
The following example will enqueue stylesheets conditionally for different headers. This is just one example of how you may use the hook and will use a secondary template file of