mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
Themes: Add a hook to filter theme header image URL.
This changeset introduces the `get_header_image` filter, which can be used to modify header image URL returned by `get_header_image()`, in themes that support the Header Image feature. Props hztyfoon, audrasjb, mukesh27, SergeyBiryukov, costdev. Fixes #56180. git-svn-id: https://develop.svn.wordpress.org/trunk@53741 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1179,6 +1179,20 @@ function get_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 ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user