Skip to content

Commit

Permalink
Merge pull request #2063 from CityOfPhiladelphia/restrict-media-types
Browse files Browse the repository at this point in the history
restrict to specific mime types
  • Loading branch information
m-atia committed Jan 3, 2024
2 parents ff00bf6 + 2ea9b64 commit 96e10cf
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion wp/wp-content/themes/phila.gov-theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2358,4 +2358,27 @@ function add_html_lang_attribute($output) {

$output = implode(' ', $attributes);
return $output;
}
}

function wpse_restrict_mimes($mime_types){
$mime_types = array(
'jpg|jpeg' => 'image/jpeg',
'png' => 'image/png',
'gif' => 'image/gif',
'svg' => 'image/svg+xml',
'pdf' => 'application/pdf',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'docx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'ppt' => 'application/vnd.ms-powerpoint',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'pages' => 'application/vnd.apple.pages',
'numbers' => 'application/vnd.apple.numbers',
'csv' => 'text/csv',
);
return $mime_types;
}

add_filter('upload_mimes', 'wpse_restrict_mimes');

0 comments on commit 96e10cf

Please sign in to comment.