Workaround to upload AVIF files


Has anyone found a good way to upload AVIF images files through the WordPress media uploader?

I’ve seen variations of this code posted everywhere:

function allowed_mime_types( $mime_types ) {

  //AVIF Images
  $mime_types['avif'] = 'image/avif';

  return $mime_types;

add_filter( 'upload_mimes', 'allowed_mime_types' );

But, when I use that I still get an error:

Sorry, this file type is not permitted for security reasons.

I confirmed that avif is added to the list of extensions in the plupload localized script vars, but still no joy. What am I missing?

Dominic P 2 months 0 Answers 10 views 0

Leave an answer