User can access only own media in wordpress
add_filter( 'ajax_query_attachments_args', 'show_users_own_attachments', 1, 1 );
function show_users_own_attachments($query){
$id = get_current_user_id();
if( !current_user_can('manage_options') )
$query['author'] = $id;
return $query;
}
No comments:
Post a Comment