Advertisements

check_upload_mimes

Definition:
function check_upload_mimes( $mimes ) {}

Check an array of MIME types against a whitelist.
WordPress ships with a set of allowed upload filetypes, which is defined in wp-includes/functions.php in get_allowed_mime_types(). This function is used to filter that list against the filetype whitelist provided by Multisite Super Admins at wp-admin/network/settings.php.

Parameters

  • array $mimes

Source code

function check_upload_mimes( $mimes ) {

	$site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );

	foreach ( $site_exts as $ext ) {

		foreach ( $mimes as $ext_pattern => $mime ) {

			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )

				$site_mimes[$ext_pattern] = $mime;

		}

	}

	return $site_mimes;

}

609

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: