By default WordPress doesn’t support uploading of AVIF images to the media library. Luckily this is super easy to fix with a minor addition to your theme’s functions.php file and a helpful plugin.

The Solution

  1. Add the following PHP code to your theme’s functions.php file:
function cmyee_allowed_mime_types( $mime_types ) {
  //AVIF Images
  $mime_types['avif'] = 'image/avif';

  return $mime_types;
}

add_filter( 'upload_mimes', 'cmyee_allowed_mime_types', 1, 1 );

2. Download & activate the Lord of the Files: Enhanced Upload Security plugin.

3. That’s it! Now you can upload AVIF images in the WordPress media library.