Skip to content

Instantly share code, notes, and snippets.

@codename065
Created May 20, 2021 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codename065/3a0d439ddc3d7b82f7d9fa13b2623a05 to your computer and use it in GitHub Desktop.
Save codename065/3a0d439ddc3d7b82f7d9fa13b2623a05 to your computer and use it in GitHub Desktop.
Introduce new file type
<?php
add_filter("wp_check_filetype_and_ext", function ($mime_type, $file, $filename, $mimes, $real_mime){
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$ext = strtolower($ext);
if($ext === 'gpg')
return ['ext' => 'gpg', 'type' => 'application/gpg', 'proper_filename' => $filename ];
}, 10, 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment