From b5ce5759aa36401a23ba10233e9daa1ce45a3f36 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 6 Feb 2017 02:51:20 +0000 Subject: [PATCH] Customize: Introduce `get_header_video_url` filter for the return value of `get_header_video_url()`. Props sanket.parmar, celloexpressions. Fixes #39512. git-svn-id: https://develop.svn.wordpress.org/trunk@40045 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/theme.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index da7fd65548..bc4e57f61c 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1338,15 +1338,24 @@ function get_header_video_url() { $id = absint( get_theme_mod( 'header_video' ) ); $url = esc_url( get_theme_mod( 'external_header_video' ) ); - if ( ! $id && ! $url ) { - return false; - } - if ( $id ) { // Get the file URL from the attachment ID. $url = wp_get_attachment_url( $id ); } + /** + * Filters the header video URL. + * + * @since 4.8.0 + * + * @param string $url Header video URL, if available. + */ + $url = apply_filters( 'get_header_video_url', $url ); + + if ( ! $id && ! $url ) { + return false; + } + return esc_url_raw( set_url_scheme( $url ) ); }