Customize: Introduce get_header_video_url filter for the return value of get_header_video_url().

Props sanket.parmar, celloexpressions, SergeyBiryukov.
Merges [40045], [40086] to the 4.7 branch.
Fixes #39512.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40087 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2017-02-20 06:47:39 +00:00
parent af53eecf76
commit 5a0a298082

View File

@ -1337,15 +1337,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.7.3
*
* @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 ) );
}