Media Library – Users view
-
Hi,
I have a front-end insert on my wordpress website. And when the user is uploading images I want that the logged user can access/view only their images. It’s not logic to see all the media library database. Just the administrator can see all the images.
I’ve tried something like:
function mymo_parse_query_useronly( $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', 'mymo_parse_query_useronly' );
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
But didn’t work !
WordPress version: 3.9.1
Appreciate some help.
Regards, Pedro.
- The topic ‘Media Library – Users view’ is closed to new replies.