Cache API: Cache the results of get_uploaded_header_images()
.
Fixes #49446. Props pbiron, SergeyBiryukov, desrosj. git-svn-id: https://develop.svn.wordpress.org/trunk@48152 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
95b9933e64
commit
9eefc4b0d9
@ -2200,6 +2200,8 @@ function get_post_states( $post ) {
|
||||
* @return string Media states string.
|
||||
*/
|
||||
function _media_states( $post ) {
|
||||
static $header_images;
|
||||
|
||||
$media_states = array();
|
||||
$stylesheet = get_option( 'stylesheet' );
|
||||
|
||||
@ -2207,7 +2209,9 @@ function _media_states( $post ) {
|
||||
$meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
|
||||
|
||||
if ( is_random_header_image() ) {
|
||||
$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
|
||||
if ( ! isset( $header_images ) ) {
|
||||
$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
|
||||
}
|
||||
|
||||
if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) {
|
||||
$media_states[] = __( 'Header Image' );
|
||||
|
Loading…
x
Reference in New Issue
Block a user