WP_Widget_Media::has_content
Whether the widget has content to show.
Method of the class: WP_Widget_Media{}
No Hooks.
Returns
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() WP Widget Media::has content code WP 7.0
protected function has_content( $instance ) {
return ( $instance['attachment_id'] && 'attachment' === get_post_type( $instance['attachment_id'] ) ) || $instance['url'];
}