• how to hide user role from user role list , showing while adding new user account through wp-admin . i want to hide Administrator user role from the list (I mean user role, not user from a specific role), check the URL to view screen shot

    https://i.ibb.co/PGzcTMQ/Untitled.jpg

    • This topic was modified 2 years, 6 months ago by affilio.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • You can use the editable_roles filter hook to modify the list of roles shown in admin dropdowns. https://developer.www.ads-software.com/reference/hooks/editable_roles/

    Add the following code in your theme’s functions.php file or, preferably, a custom plugin:

    
    add_filter( 'editable_roles', function( $roles ) {
    
    	unset( $roles['administrator'] );
    	
    	return $roles;
    } );
    

    That would remove the administrator role from all dropdowns, even if you’re looking at it when logged in as an administrator yourself.

Viewing 1 replies (of 1 total)
  • The topic ‘How to hide user role from user role list ?’ is closed to new replies.