wp/wp-includes/widgets/class-wp-widget-media-gallery.php
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   246 	 * @return bool Whether widget has content.
   246 	 * @return bool Whether widget has content.
   247 	 */
   247 	 */
   248 	protected function has_content( $instance ) {
   248 	protected function has_content( $instance ) {
   249 		if ( ! empty( $instance['ids'] ) ) {
   249 		if ( ! empty( $instance['ids'] ) ) {
   250 			$attachments = wp_parse_id_list( $instance['ids'] );
   250 			$attachments = wp_parse_id_list( $instance['ids'] );
       
   251 			// Prime attachment post caches.
       
   252 			_prime_post_caches( $attachments, false, false );
   251 			foreach ( $attachments as $attachment ) {
   253 			foreach ( $attachments as $attachment ) {
   252 				if ( 'attachment' !== get_post_type( $attachment ) ) {
   254 				if ( 'attachment' !== get_post_type( $attachment ) ) {
   253 					return false;
   255 					return false;
   254 				}
   256 				}
   255 			}
   257 			}