Last active
November 7, 2019 11:27
-
-
Save plugin-republic/69f13f942a95cba8042c835762903745 to your computer and use it in GitHub Desktop.
Allow the user to upload PDFs with the upload field
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
<?php | |
// Add PDFs to list of permitted mime types | |
function my_prefix_pewc_get_permitted_mimes( $permitted_mimes ) { | |
// Add PDF to the list of permitted mime types | |
$permitted_mimes['pdf'] = "application/pdf"; | |
// Remove a mime type - uncomment the line below if you wish to prevent JPGs from being uploaded | |
// unset( $permitted_mimes['jpg|jpeg|jpe'] ); | |
return $permitted_mimes; | |
} | |
add_filter( 'pewc_permitted_mimes', 'my_prefix_pewc_get_permitted_mimes' ); | |
// Add PDF to the list of restricted filetypes | |
function my_prefix_pewc_protected_directory_allowed_filetypes( $restricted_filetypes ) { | |
$restricted_filetypes[] = 'pdf'; | |
return $restricted_filetypes; | |
} | |
add_filter( 'pewc_protected_directory_allowed_filetypes', 'my_prefix_pewc_protected_directory_allowed_filetypes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment