is_header_video_active()WP 4.7.0

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

Hooks from the function


true|false. True if the custom header video should be shown. False if not.





#1 Let's display the header video

Check if the header video is there and if it should be displayed on the current page. If it's OK, we show the player with the video playing.

// check if there is a header video and it should show on the current page.
if( has_header_video() && is_header_video_active() ){
	// url to video - get_header_video_url()

As a result, the HTML code of the video player will appear in place of this code, and the necessary scripts for the player will be connected to the page (at the end):

<div id="wp-custom-header" class="wp-custom-header">
	<video id="wp-custom-header-video" autoplay="" loop="" width="954" height="1300" src=""></video>
	<button type="button" id="wp-custom-header-video-button" class="wp-custom-header-video-button wp-custom-header-video-play">Pause</button>

Scripts in the footer:

<script type='text/javascript' src=''></script>

<script type='text/javascript' src=''></script>

<script type='text/javascript' src=''></script>


Since 4.7.0 Introduced.

is_header_video_active() code WP 6.5.3

function is_header_video_active() {
	if ( ! get_theme_support( 'custom-header', 'video' ) ) {
		return false;

	$video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' );

	if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) {
		$show_video = true;
	} else {
		$show_video = call_user_func( $video_active_cb );

	 * Filters whether the custom header video is eligible to show on the current page.
	 * @since 4.7.0
	 * @param bool $show_video Whether the custom header video should be shown. Returns the value
	 *                         of the theme setting for the `custom-header`'s `video-active-callback`.
	 *                         If no callback is set, the default value is that of `is_front_page()`.
	return apply_filters( 'is_header_video_active', $show_video );