WordPress at a glance

the_header_video_url() WP 4.7.0

Displays header video URL specified in theme Customizer (theme settings).

Displays a link to a local or an external video. Displays nothing if there is no video.

Use get_header_video_url() to get a header video URL for further processing.

You can learn more about video headers here

Works based on: get_header_video_url()

No Hooks.


Null. Nothing.


<?php the_header_video_url(); ?>


#1 Display HTML video tag

Check whether a header video is set to not display an empty video tag:

<?php if( has_header_video() ){ ?>
	<video class="wp-video-shortcode" id="video-298-1" width="600" height="400" preload="metadata" controls="controls">
		<source type="video/mp4" src="<?php the_header_video_url() ?>" />
<?php } ?>


Since 4.7.0 Introduced.

Code of the_header_video_url() WP 5.5.1

function the_header_video_url() {
	$video = get_header_video_url();

	if ( $video ) {
		echo esc_url( $video );

From tag: custom_header (theme options: video color image)

More from category: Other Theme Functions

No comments
    Log In . Register