函数原型
get_header_image(): string|false
函数描述
Retrieves header image for custom header.
是否弃用
未弃用
函数参数
无
函数返回值
string|false
函数位置
File: wp-includes/theme.php.
函数源码
function get_header_image() {
$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
if ( 'remove-header' === $url ) {
return false;
}
if ( is_random_header_image() ) {
$url = get_random_header_image();
}
/**
* Filters the header image URL.
*
* @since 6.1.0
*
* @param string $url Header image URL.
*/
$url = apply_filters( 'get_header_image', $url );
if ( ! is_string( $url ) ) {
return false;
}
$url = trim( $url );
return sanitize_url( set_url_scheme( $url ) );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |

