WP_Widget_Media::has_content() WordPress Method
The WP_Widget_Media::has_content() method is used to check if a widget has any content. This is useful for widgets that allow users to input content, such as text or images.
WP_Widget_Media::has_content( array $instance ) #
Whether the widget has content to show.
Parameters
- $instance
(array)(Required)Widget instance props.
Return
(bool) Whether widget has content.
Source
File: wp-includes/widgets/class-wp-widget-media.php
protected function has_content( $instance ) { return ( $instance['attachment_id'] && 'attachment' === get_post_type( $instance['attachment_id'] ) ) || $instance['url']; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.8.0 | Introduced. |