relevanssi_accept_mime_type

apply_filters( 'relevanssi_accept_mime_type', bool $accept, string $mime_type )

Allows the filtering of attachment reading based on MIME type.

Parameters

$accept
(boolean) True, if it’s ok to read the attachment, false if not.

$mime_type
(string) The attachment MIME type.

More information

This filter hook is used in the attachment reading. Relevanssi blocks certain MIME types by default:

  • anything with video or image in the first part of the type
  • anything with zip, octet-stream, x-zip-compressed, or x-zip in the second part of the type

This filter hook can be used to block more MIME types. Let’s say you want to block Relevanssi from reading the Open Document presentations in your Media Library:

add_filter( 'relevanssi_accept_mime_type', 'rlv_block_odp_files', 10, 2 );
function rlv_block_odp_files( $accept, $mime_type ) {
  if ( 'application/vnd.oasis.opendocument.presentation' === $mime_type ) {
     $accept = false;
  }
  return $accept;
}