How to check if “media_send_to_editor” is audio?

We can simplify the mime type checks, with the following boolean functions:

  • wp_attachment_is( 'image', $id )

  • wp_attachment_is( 'video', $id )

  • wp_attachment_is( 'audio', $id )

where $id is the attachment ID.

The attachment’s ID is actually one of the input arguments for the media_send_to_editor filter callback.

We also have:

  • wp_attachment_is_image( $id )

that’s a wrapper for wp_attachment_is( 'image', $id ).

References:

error code: 523