Codex tools: Log in
Contents |
Retrieve list of allowed mime types and file extensions.
<?php get_allowed_mime_types(); ?>
None.
<?php
function get_icon_by_file_extension($file_ext) {
$mimes = get_allowed_mime_types();
foreach ($mimes as $type => $mime) {
if (strpos($type, $file_ext) !== false) {
return wp_mime_type_icon($mime);
}
}
}
?>
<img src="<?php echo get_icon_by_file_extension('mp4') ?>" />
Since: 2.8.6
get_allowed_mime_types() is located in wp-includes/functions.php