get_header_video_url

Retrieve header video URL for custom header.

Description

(string|false) get_header_video_url(); 

Uses a local video if present, or falls back to an external video. Returns false if there is no video.

Returns (string|false)


Usage

  1. if ( !function_exists( 'get_header_video_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_header_video_url(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/theme.php  
  1. function get_header_video_url() { 
  2. $id = absint( get_theme_mod( 'header_video' ) ); 
  3. $url = esc_url( get_theme_mod( 'external_header_video' ) ); 
  4.  
  5. if ( $id ) { 
  6. // Get the file URL from the attachment ID. 
  7. $url = wp_get_attachment_url( $id ); 
  8.  
  9. /** 
  10. * Filters the header video URL. 
  11. * @since 4.7.3 
  12. * @param string $url Header video URL, if available. 
  13. */ 
  14.  
  15. if ( ! $id && ! $url ) { 
  16. return false; 
  17.  
  18. return esc_url_raw( set_url_scheme( $url ) );