Filter hook 'upload_mimes'

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

View Source

upload_mimes

Filter Hook
Description
Filters the list of allowed mime types and file extensions.

Hook Information

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

Hook Parameters

Type Name Description
array $t Mime types keyed by the file extension regex corresponding to those types.
int|WP_User|null $user User ID, User object or null if not provided (indicates current user).

Usage Examples

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

function my_custom_filter($t, $user) {
    // Your custom filtering logic here
    return $t;
}

Source Code Context

wp-includes/functions.php:3660 - How this hook is used in WordPress core
<?php
3655  	 * @since 2.0.0
3656  	 *
3657  	 * @param array            $t    Mime types keyed by the file extension regex corresponding to those types.
3658  	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
3659  	 */
3660  	return apply_filters( 'upload_mimes', $t, $user );
3661  }
3662  
3663  /**
3664   * Displays "Are You Sure" message to confirm the action being taken.
3665   *

PHP Documentation

<?php
/**
	 * Filters the list of allowed mime types and file extensions.
	 *
	 * @since 2.0.0
	 *
	 * @param array            $t    Mime types keyed by the file extension regex corresponding to those types.
	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.