Last active
August 29, 2015 14:04
-
-
Save wokamoto/a0020005e052a4c6b610 to your computer and use it in GitHub Desktop.
[WordPress プラグイン開発のバイブル] P367 訂正
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('upload_mimes', 'my_mime_types', 1, 1); | |
function my_mime_types($mime_types){ | |
// 許可するファイルタイプを列挙した連想配列 | |
// キーは拡張子を正規表現で、値は mime タイプ | |
$mime_types = array( | |
'jpg|jpeg|jpe' => 'image/jpeg', | |
'gif' => 'image/gif', | |
'png' => 'image/png', | |
'bmp' => 'image/bmp', | |
'tif|tiff' => 'image/tiff', | |
); | |
return $mime_types; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment