# Add Modern Image Formats to Network Upload Types

> Adds WebP and AVIF to the file types every site on the network may upload, without editing the "Upload file types" list in Network Settings.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: uploads, file-types, webp
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-network-upload-file-types/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

$wpide_extra = array( 'webp', 'avif' ); // Extensions to allow.

add_filter( 'site_option_upload_filetypes', function ( $types ) use ( $wpide_extra ) {
    $list = array_filter( explode( ' ', strtolower( (string) $types ) ) );

    return implode( ' ', array_unique( array_merge( $list, $wpide_extra ) ) );
} );
```

## Notes

Add other extensions to $wpide_extra; the server must also allow their MIME types.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add Modern Image Formats to Network Upload Types" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
