Customize: Avoid unnecessary `get_theme_mod()` call and premature escaping in `get_header_video_url()`.

The result is still escaped with `esc_url_raw()` for retrieval, and with `esc_url()` for display in `the_header_video_url()`.

Props dlh, Tkama.
Fixes #40044.

git-svn-id: https://develop.svn.wordpress.org/trunk@47267 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-02-11 16:34:09 +00:00
parent 5866986d74
commit 2599e1b4fb
1 changed files with 3 additions and 2 deletions

View File

@ -1427,12 +1427,13 @@ function has_header_video() {
* @return string|false Header video URL or false if there is no video.
*/
function get_header_video_url() {
$id = absint( get_theme_mod( 'header_video' ) );
$url = esc_url( get_theme_mod( 'external_header_video' ) );
$id = absint( get_theme_mod( 'header_video' ) );
if ( $id ) {
// Get the file URL from the attachment ID.
$url = wp_get_attachment_url( $id );
} else {
$url = get_theme_mod( 'external_header_video' );
}
/**