wppaste
WordPress

get_allowed_mime_types( int|WP_User $user = null ): string[]

Since
2.8.6
Source
wp-includes/functions.php:3693
Retrieves the list of allowed mime types and file extensions.

Parameters

$userint|WP_Useroptional
User to check. Defaults to current user.Default: null

Return

string[]
Array of mime types keyed by the file extension regex corresponding to those types.

Hooks fired · 1

One hook fires while get_allowed_mime_types() runs, in this order:

  1. apply_filters( upload_mimes )filterline 3713 (+20 into the body)

    Filters the list of allowed mime types and file extensions.

Uses · 4

Used by · 10

Source

function get_allowed_mime_types( $user = null ) {	$t = wp_get_mime_types(); 	unset( $t['swf'], $t['exe'] );	if ( function_exists( 'current_user_can' ) ) {		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );	} 	if ( empty( $unfiltered ) ) {		unset( $t['htm|html'], $t['js'] );	} 	/**	 * 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).	 */	return apply_filters( 'upload_mimes', $t, $user );}

History

Introduced in 2.8.6. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.