函数原型
get_header_video_url(): string|false
函数描述
Retrieves header video URL for custom header.
是否弃用
未弃用
函数参数
无
函数返回值
string|false Header video URL or false if there is no video.
函数位置
File: wp-includes/theme.php.
函数源码
function get_header_video_url() {
$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' );
}
/**
* 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 sanitize_url( set_url_scheme( $url ) );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |

