Title: ext2type
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘ext2type’, array[] $ext2type )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#wp--skip-link--target)

Filters file type based on the extension name.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#see-also)󠁿

 * [wp_ext2type()](https://developer.wordpress.org/reference/functions/wp_ext2type/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#parameters)󠁿

 `$ext2type`array[]

Multi-dimensional array of file extensions types keyed by the type of file.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#source)󠁿

    ```php
    return apply_filters(
    	'ext2type',
    	array(
    		'image'       => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'heif', 'webp', 'avif' ),
    		'audio'       => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
    		'video'       => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
    		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ),
    		'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),
    		'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
    		'text'        => array( 'asc', 'csv', 'tsv', 'txt' ),
    		'archive'     => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
    		'code'        => array( 'css', 'htm', 'html', 'php', 'js' ),
    	)
    );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L3585)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L3585-L3598)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_get_ext_types()](https://developer.wordpress.org/reference/functions/wp_get_ext_types/)`wp-includes/functions.php` |

Retrieves the list of common file extensions and their types.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/ext2type/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fext2type%2F)
before being able to contribute a note or feedback.