Last active
December 7, 2017 13:57
-
-
Save zartgesotten/ffb649f4b7118798bab3fb1d9f545bea to your computer and use it in GitHub Desktop.
This goes into a small plugin and into the folder mu-plugins ... User can now only upload images and pdf
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_filter('upload_mimes','restrict_mimes_for_subscriber'); | |
function restrict_mimes_for_subscriber($mimes) { | |
if (!current_user_can('read')) { | |
return; | |
} | |
$mimes = array( | |
'pdf' => 'application/pdf', | |
'jpg|jpeg' => 'image/jpeg', | |
'png' => 'image/png', | |
'gif' => 'imgage/gif' | |
); | |
return $mimes; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment