wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_post_mime_types › WordPress Function
Seit2.9.0
Veraltetn/v
› get_post_mime_types ( Keine Parameter )
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
Gets default post mime types.
Ähnliche Funktionen: get_post_mime_type, get_post_types, get_post_type, get_available_post_mime_types, get_allowed_mime_types
Quellcode
function get_post_mime_types() { $post_mime_types = array( // array( adj, noun ) 'image' => array( __( 'Images' ), __( 'Manage Images' ), /* translators: %s: Number of images. */ _n_noop( 'Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>' ), ), 'audio' => array( _x( 'Audio', 'file type group' ), __( 'Manage Audio' ), /* translators: %s: Number of audio files. */ _n_noop( 'Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>' ), ), 'video' => array( _x( 'Video', 'file type group' ), __( 'Manage Video' ), /* translators: %s: Number of video files. */ _n_noop( 'Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>' ), ), 'document' => array( __( 'Documents' ), __( 'Manage Documents' ), /* translators: %s: Number of documents. */ _n_noop( 'Document <span class="count">(%s)</span>', 'Documents <span class="count">(%s)</span>' ), ), 'spreadsheet' => array( __( 'Spreadsheets' ), __( 'Manage Spreadsheets' ), /* translators: %s: Number of spreadsheets. */ _n_noop( 'Spreadsheet <span class="count">(%s)</span>', 'Spreadsheets <span class="count">(%s)</span>' ), ), 'archive' => array( _x( 'Archives', 'file type group' ), __( 'Manage Archives' ), /* translators: %s: Number of archives. */ _n_noop( 'Archive <span class="count">(%s)</span>', 'Archives <span class="count">(%s)</span>' ), ), ); $ext_types = wp_get_ext_types(); $mime_types = wp_get_mime_types(); foreach ( $post_mime_types as $group => $labels ) { if ( in_array( $group, array( 'image', 'audio', 'video' ), true ) ) { continue; } if ( ! isset( $ext_types[ $group ] ) ) { unset( $post_mime_types[ $group ] ); continue; } $group_mime_types = array(); foreach ( $ext_types[ $group ] as $extension ) { foreach ( $mime_types as $exts => $mime ) { if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { $group_mime_types[] = $mime; break; } } } $group_mime_types = implode( ',', array_unique( $group_mime_types ) ); $post_mime_types[ $group_mime_types ] = $labels; unset( $post_mime_types[ $group ] ); } /** * Filters the default list of post mime types. * * @since 2.5.0 * * @param array $post_mime_types Default list of post mime types. */ return apply_filters( 'post_mime_types', $post_mime_types ); }