Home / APIs / check_upload_mimes() – Check an array of MIME types against a whitelist.

You appear to be a bot. Output may be restricted

Description

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.

Usage

$array = check_upload_mimes( $mimes );

Parameters

$mimes
( array ) required –

Returns

array

Source

File name: wordpress/wp-includes/ms-functions.php
Lines: 1 to 11 of 11

function check_upload_mimes( $mimes ) {
  $site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
  $site_mimes = array();
  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;
}
 

 View on GitHub View on Trac

Published: 10th March 2017 | Last updated: 10th March 2017

Information

Function name: check_upload_mimes
Plugin ref: WordPress
Version: 5.0.3
Sourcefile: wp-includes/ms-functions.php
File ref: wp-includes/ms-functions.php
Deprecated?: No
API Letters: C,M,U

  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Files
  • Hooks
  • Classes
  • Home
  • Sites
  • Sitemap
  • Blog
oik-plugins WordPress a2z
WordPress Dynamic API Reference

Site:  wp-a2z.org
© Copyright oik-plugins 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins