Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #8210

    Hi, I have a question or issue I need to resolve.
    The website I’m working on is supposed to allow certain user roles the upload of specific files (.rpt).
    While researching it I found this code (I’m not a PHP coder):
    add_filter( ‘upload_mimes’, ‘my_myme_types’, 1, 1 );
    function my_myme_types( $mime_types ) {
    $mime_types[‘rpt’] = ‘application/rpt’; // Adding .rpt extension

    unset( $mime_types[‘xls’] ); // Remove .xls extension
    unset( $mime_types[‘xlsx’] ); // Remove .xlsx extension

    return $mime_types;

    Now this works great, but only for administrators. It doesn’t work for any other user role.
    I need it to work for Editors, Authors, or Custom User roles.

    Can anybody offer advice?



    Is it a single or multisite WordPress installation?


    Btw., there is no item with ‘xls’ key in the list of allowed mime types. You should use this one instead:

    unset( $mime_types['xla|xls|xlt|xlw'']

    Full list of mime types allowed at WP by default is available here.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.