Title: the_custom_header_markup
Published: December 7, 2016
Last modified: February 24, 2026

---

# the_custom_header_markup()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#wp--skip-link--target)

Prints the markup for a custom header.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#description)󠁿

A container div will always be printed in the Customizer preview.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#source)󠁿

    ```php
    function the_custom_header_markup() {
    	$custom_header = get_custom_header_markup();
    	if ( empty( $custom_header ) ) {
    		return;
    	}

    	echo $custom_header;

    	if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) {
    		wp_enqueue_script( 'wp-custom-header' );
    		wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/theme.php#L1826)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/theme.php#L1826-L1838)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#related)󠁿

| Uses | Description | 
| [get_custom_header_markup()](https://developer.wordpress.org/reference/functions/get_custom_header_markup/)`wp-includes/theme.php` |

Retrieves the markup for a custom header.

  | 
| [is_header_video_active()](https://developer.wordpress.org/reference/functions/is_header_video_active/)`wp-includes/theme.php` |

Checks whether the custom header video is eligible to show on the current page.

  | 
| [has_header_video()](https://developer.wordpress.org/reference/functions/has_header_video/)`wp-includes/theme.php` |

Checks whether a header video is set or not.

  | 
| [get_header_video_settings()](https://developer.wordpress.org/reference/functions/get_header_video_settings/)`wp-includes/theme.php` |

Retrieves header video settings.

  | 
| [is_customize_preview()](https://developer.wordpress.org/reference/functions/is_customize_preview/)`wp-includes/theme.php` |

Whether the site is being previewed in the Customizer.

  | 
| [wp_enqueue_script()](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)`wp-includes/functions.wp-scripts.php` |

Enqueues a script.

  | 
| [wp_localize_script()](https://developer.wordpress.org/reference/functions/wp_localize_script/)`wp-includes/functions.wp-scripts.php` |

Localizes a script.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/the_custom_header_markup/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fthe_custom_header_markup%2F)
before being able to contribute a note or feedback.