Last active
July 22, 2016 14:32
-
-
Save purcebr/30dc99ed0f8065f23c4086bffe310390 to your computer and use it in GitHub Desktop.
Allow Media MIME Type Uploads based on user role
This file contains hidden or 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
add_filter('upload_mimes', 'admin_upload_svg'); | |
function admin_upload_svg ( $existing_mimes=array() ) { | |
$user = wp_get_current_user(); | |
// If the user is an admin, add the svg mimetype to the list. | |
if(in_array( 'administrator', (array) $user->roles )) { | |
$existing_mimes['svg'] = 'mime/type'; | |
} | |
return $existing_mimes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment