Uses
Uses | Description |
---|---|
wp-includes/functions.php: wp_parse_id_list() | Clean up an array, comma- or space-separated list of IDs. |
wp-includes/post.php: get_post_type() | Retrieves the post type of the current post or of a given post. |
Whether the widget has content to show.
(array) (Required) Widget instance props.
(bool) Whether widget has content.
File: wp-includes/widgets/class-wp-widget-media-gallery.php
protected function has_content( $instance ) { if ( ! empty( $instance['ids'] ) ) { $attachments = wp_parse_id_list( $instance['ids'] ); foreach ( $attachments as $attachment ) { if ( 'attachment' !== get_post_type( $attachment ) ) { return false; } } return true; } return false; }
Version | Description |
---|---|
4.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget_media_gallery/has_content