WordPress at a glance
function is not described

WP_Widget_Media::is_attachment_with_mime_type() public WP 4.8.0

Determine if the supplied attachment is for a valid attachment post with the specified MIME type.

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

No Hooks.

Return

true|false. Is matching MIME type.

Usage

$WP_Widget_Media = new WP_Widget_Media();
$WP_Widget_Media->is_attachment_with_mime_type( $attachment, $mime_type );
$attachment(int|WP_Post) (required)
Attachment post ID or object.
$mime_type(string) (required)
MIME type.

Changelog

Since 4.8.0 Introduced.

Code of WP_Widget_Media::is_attachment_with_mime_type() WP 5.7.2

<?php
public function is_attachment_with_mime_type( $attachment, $mime_type ) {
	if ( empty( $attachment ) ) {
		return false;
	}
	$attachment = get_post( $attachment );
	if ( ! $attachment ) {
		return false;
	}
	if ( 'attachment' !== $attachment->post_type ) {
		return false;
	}
	return wp_attachment_is( $mime_type, $attachment );
}