Skip Navigation

Access setting to limit media library to own media doesn’t work with Add Media button of WYSIWYG editor

Open

Symptoms

Front-end forms that include a WYSIWYG editor (including for the post content) can include an Add Media button (determined by the form settings).

That opens up the WordPress Media Library, which may display all uploaded media, or—according to Access settings for the form—may only show the current user’s own uploads.

That setting works for media fields, but not for the Add Media button on a WYSIWYG editor, when all media are always shown.

Workaround

There currently is no workaround.

One thought on Access setting to limit media library to own media doesn't work with Add Media button of WYSIWYG editor

  • 2 temporary workaround.

    1_Using this plugin seems to fix the issue: https://wordpress.org/plugins/frontier-restrict-media/

    2_this custom code work only for grid view. Switching to list view will show all media files in media library.

    add_filter( 'ajax_query_attachments_args', 'role_azienda' );
    function role_azienda( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id && current_user_can('azienda') ) {
    $query['author'] = $user_id;
    }
    return $query;
    }

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>