WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Access to media library

[Resolved] Access to media library

  • Hi,
    I use a little snippet to restrict an access to media library:
    function my_files_only( $wp_query ) {
    if ( strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘/wp-admin/upload.php’ ) !== false ) {
    if ( !current_user_can( ‘level_5’ ) ) {
    global $current_user;
    $wp_query->set( ‘author’, $current_user->id );
    }
    }
    }
    add_filter(‘parse_query’, ‘my_files_only’ );

    When a user click on “Media” —> “Library” will see only it’s own media files. That is great for me.

    The problem is when the user want to “Add a Media”. The the user is able to see all files in the library and to operate with all of them, which is not what I want.

    Can you advise me, please, how to a solve the problem.

    Thank you in advance!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Access to media library’ is closed to new replies.
Skip to toolbar