Filter hook 'ext2type'

in WP Core File wp-includes/functions.php at line 3577

View Source

ext2type

Filter Hook
Description
Filters file type based on the extension name.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 3577

Hook Parameters

Type Name Description
array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.

Usage Examples

Basic Usage
<?php
// Hook into ext2type
add_filter('ext2type', 'my_custom_filter', 10, 1);

function my_custom_filter($ext2type) {
    // Your custom filtering logic here
    return $ext2type;
}

Source Code Context

wp-includes/functions.php:3577 - How this hook is used in WordPress core
<?php
3572  	 *
3573  	 * @see wp_ext2type()
3574  	 *
3575  	 * @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
3576  	 */
3577  	return apply_filters(
3578  		'ext2type',
3579  		array(
3580  			'image'       => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'heif', 'webp', 'avif' ),
3581  			'audio'       => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
3582  			'video'       => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),

PHP Documentation

<?php
/**
	 * Filters file type based on the extension name.
	 *
	 * @since 2.5.0
	 *
	 * @see wp_ext2type()
	 *
	 * @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.