WP_Widget_Media_Gallery::has_content( array $instance )

Whether the widget has content to show.


Parameters

$instance

(Required) Widget instance props.


Return

(bool) Whether widget has content.


Source

File: wp-includes/widgets/class-wp-widget-media-gallery.php

	protected function has_content( $instance ) {
		if ( ! empty( $instance['ids'] ) ) {
			$attachments = wp_parse_id_list( $instance['ids'] );
			foreach ( $attachments as $attachment ) {
				if ( 'attachment' !== get_post_type( $attachment ) ) {
					return false;
				}
			}
			return true;
		}
		return false;
	}


Changelog

Changelog
Version Description
WP-4.9.0 Introduced.