WordPress at a glance
function is not described

WP_Widget_Media::has_content() protected WP 4.8.0

Whether the widget has content to show.

{} It's a method of the class: WP_Widget_Media{}

No Hooks.


true|false. Whether widget has content.


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


Since 4.8.0 Introduced.

Code of WP_Widget_Media::has_content() WP 5.7.2

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