WP_Widget_Media_Gallery::has_content

Advertisement

Summery Summery

Whether the widget has content to show.

Syntax Syntax

WP_Widget_Media_Gallery::has_content( array $instance )

Parameters Parameters

$instance

(array) (Required) Widget instance props.

Return Return

(bool) Whether widget has content.

Source 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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.