Whether the widget has content to show.
Parameters
$instance
arrayrequired- Widget instance props.
Source
protected function has_content( $instance ) {
if ( ! empty( $instance['ids'] ) ) {
$attachments = wp_parse_id_list( $instance['ids'] );
// Prime attachment post caches.
_prime_post_caches( $attachments, false, false );
foreach ( $attachments as $attachment ) {
if ( 'attachment' !== get_post_type( $attachment ) ) {
return false;
}
}
return true;
}
return false;
}
Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.