The is_header_video_active WordPress PHP Filter allows you to control the display of the custom header video on a specific page.
Usage
add_filter('is_header_video_active', 'your_custom_function_name'); function your_custom_function_name($show_video) { // your custom code here return $show_video; }
Parameters
- $show_video (bool): Determines whether the custom header video should be shown or not. It 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()
.
More information
See WordPress Developer Resources: is_header_video_active
Examples
Show header video on blog page
This example will display the custom header video on the blog page.
add_filter('is_header_video_active', 'show_header_video_on_blog_page'); function show_header_video_on_blog_page($show_video) { if (is_home()) { return true; } return $show_video; }
Hide header video on specific page by ID
This example will hide the custom header video on a specific page by its ID.
add_filter('is_header_video_active', 'hide_header_video_on_specific_page'); function hide_header_video_on_specific_page($show_video) { if (is_page(42)) { return false; } return $show_video; }
Show header video on all pages
This example will display the custom header video on all pages.
add_filter('is_header_video_active', 'show_header_video_on_all_pages'); function show_header_video_on_all_pages($show_video) { return true; }
Hide header video on all single posts
This example will hide the custom header video on all single posts.
add_filter('is_header_video_active', 'hide_header_video_on_single_posts'); function hide_header_video_on_single_posts($show_video) { if (is_single()) { return false; } return $show_video; }
Show header video on custom post type archive
This example will display the custom header video on a custom post type archive page.
add_filter('is_header_video_active', 'show_header_video_on_custom_post_type_archive'); function show_header_video_on_custom_post_type_archive($show_video) { if (is_post_type_archive('your_custom_post_type')) { return true; } return $show_video; }