WP_Widget_Media::has_content()protectedWP 4.8.0

Whether the widget has content to show.

Method of the class: WP_Widget_Media{}

No Hooks.

Return

true|false. Whether widget has content.

Usage

// protected - for code of main (parent) or child class
$result = $this->has_content( $instance );
$instance(array) (required)
Widget instance props.

Changelog

Since 4.8.0 Introduced.

WP_Widget_Media::has_content() code WP 6.5.3

protected function has_content( $instance ) {
	return ( $instance['attachment_id'] && 'attachment' === get_post_type( $instance['attachment_id'] ) ) || $instance['url'];
}