WP_Widget_Media::has_content()protectedWP 4.8.0

Whether the widget has content to show.

{} It's a 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.

Code of WP_Widget_Media::has_content() WP 6.1.1

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