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.
Built from https://develop.svn.wordpress.org/trunk@47267


git-svn-id: http://core.svn.wordpress.org/trunk@47067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-11 16:36:06 +00:00
parent 0fcc994a8f
commit 5bf387bb07
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47266'; $wp_version = '5.4-alpha-47267';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.