Support

Account

Home Forums Front-end Issues Front-end form: Image upload problem Reply To: Front-end form: Image upload problem

  • 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;
    
    }