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. Built from https://develop.svn.wordpress.org/trunk@53741 git-svn-id: http://core.svn.wordpress.org/trunk@53300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
63d113e62c
commit
bcf4ff0c3f
|
@ -1179,6 +1179,20 @@ function get_header_image() {
|
||||||
$url = get_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 ) );
|
return sanitize_url( set_url_scheme( $url ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-alpha-53740';
|
$wp_version = '6.1-alpha-53741';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue