I have a form for users to upload images to a new custom post type. The form resides on a WordPress page, using a page template to include the required ACF code.
The issue is that when a user clicks “Add Image”, all the images in the Media Library show up in the uploader’s “Media Library” tab as “uploaded to this post”.
How can I stop such media from being displayed?
Thanks
I have exactly the same problem.
@Elliot – any chance you could take a look at this?
You can add this to your functions.php to restrict shown media to the items owned by the current user:
add_action('pre_get_posts','my_restrict_media_library');
function my_restrict_media_library( $wp_query_obj ) {
global $current_user, $pagenow;
if( !is_a( $current_user, 'WP_User') )
return;
if( 'admin-ajax.php' != $pagenow || $_REQUEST['action'] != 'query-attachments' )
return;
if( !current_user_can('edit_files') )
$wp_query_obj->set('author', $current_user->ID );
return;
}