get_header_image() WordPress Function
The get_header_image() function allows you to retrieve the URL of the header image set for the current theme. This can be useful if you want to use the header image in a custom location or for further customization.
get_header_image() #
Retrieves header image for custom header.
Return
(string|false)
Source
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();
}
return esc_url_raw( set_url_scheme( $url ) );
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |