Created
March 22, 2017 09:55
-
-
Save rahul3883/e4498817c745b9513653bbdbb4dfc4a0 to your computer and use it in GitHub Desktop.
Allow only pdf documents on upload
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 | |
/** | |
* Allow only pdf documents on upload. | |
* | |
* Only allow documents which has pdf extension. | |
* | |
* @param array $allowed_types Allowed types of media to upload. | |
* | |
* @return array Allowed types of media to upload | |
*/ | |
function tmp_rtm_change_allowed_types_documents( $allowed_types ) { | |
if ( isset( $allowed_types['document'], $allowed_types['document']['extn'] ) ) { | |
// change allowed document type to pdf only. | |
$allowed_types['document']['extn'] = array( 'pdf' ); | |
} | |
return $allowed_types; | |
} | |
add_filter( 'rtmedia_allowed_types', 'tmp_rtm_change_allowed_types_documents', 999, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this code snippet in a
php file
inmu-plugins
folder of your site