[Resolved] Hide [Upload files] by role at Media Library

Home Forums Support [Resolved] Hide [Upload files] by role at Media Library

Home Forums Support Hide [Upload files] by role at Media Library

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2394493
    martin_ym

    How to:
    a) Hide [Upload files] by role?
    b) Insert image from URL and display it at [Media Library] without upload?

    #2395186
    David
    Staff
    Customer Support

    Hi there,

    a) WordPress has its won User Roles and Capabilities:

    https://wordpress.org/support/article/roles-and-capabilities/

    And there are a few functions you can use the remove_cap() function to remove them:

    https://developer.wordpress.org/reference/classes/wp_role/remove_cap/

    And you can use it in a PHP Snippet like so:

    
    function remove_author_upload_media() {
    	// get_role returns an instance of WP_Role.
    	$role = get_role( 'author' );
    	$role->remove_cap( 'upload_files' );
    }
    add_action( 'init', 'remove_author_upload_media' );

    This removes the upload_files cap from the role of author

    b) unfortunately i do not know how to do this. Have a look for a plugin for Advanced Media Manager

    #2396106
    martin_ym

    Thanks for help, resolved.

    #2396426
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.