Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress プラグイン開発のバイブル] P367 訂正
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
You can’t perform that action at this time.