diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/widgets/class-wp-widget-media-gallery.php --- a/wp/wp-includes/widgets/class-wp-widget-media-gallery.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/widgets/class-wp-widget-media-gallery.php Fri Sep 05 18:40:08 2025 +0200 @@ -248,6 +248,8 @@ protected function has_content( $instance ) { if ( ! empty( $instance['ids'] ) ) { $attachments = wp_parse_id_list( $instance['ids'] ); + // Prime attachment post caches. + _prime_post_caches( $attachments, false, false ); foreach ( $attachments as $attachment ) { if ( 'attachment' !== get_post_type( $attachment ) ) { return false;