Created
October 11, 2022 16:57
-
-
Save jstask82/86c522991413dfc0b76fffce62a6a3c3 to your computer and use it in GitHub Desktop.
you ned to disable list view for this to work, use adminimize!
This file contains 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( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' ); | |
function wpb_show_current_user_attachments( $query ) { | |
$user_id = get_current_user_id(); | |
//has the capability to activate plugins or edit other user’s posts? if not limit files to users id | |
if ( $user_id && !current_user_can('activate_plugins') && !current_user_can('edit_others_posts | |
') ) { | |
$query['author'] = $user_id; | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment