Restrict author to their own media (Featured Image)
-
Hi, I hope some knowledgeable peeps here can help with a simple issue I’m having.
I host a multi author site and I’ve restricted their media access to their own in the backend when adding a new post by using
//restrict authors to only being able to view media that they've uploaded function ik_eyes_only( $wp_query ) { //are we looking at the Media Library or the Posts list? if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false || strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) { //user level 5 converts to Editor if ( !current_user_can( 'level_5' ) ) { //restrict the query to current user global $current_user; $wp_query->set( 'author', $current_user->id ); } } } //filter media library & posts list for authors add_filter('parse_query', 'ik_eyes_only' );
This works fantastic, the only issue I’m having right now is that when they click to “set featured image” (part of my theme) they can see access all authors uploaded images, which yes is bad. How can I restrict them to only see their images when accessing the set featured image feature?
Thanks for any help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Restrict author to their own media (Featured Image)’ is closed to new replies.