mdelange
4/25/2017 - 8:14 AM

wp_show_only_users_media.php

<?php
add_action('pre_get_posts', function($query)
{
	global $current_user, $pagenow;

	if (!$current_user instanceof WP_User)
		return;

	if ($pagenow != 'admin-ajax.php' || $_REQUEST['action'] != 'query-attachments')
		return;

	if (!current_user_can('update_core'))
		$query->set('author', $current_user->ID);
});