I don’t want to accidentally select Administrator role.
So is there a way to remove it from Settings -> General -> New User Default Role
?
I don’t want to accidentally select Administrator role.
So is there a way to remove it from Settings -> General -> New User Default Role
?
You must be logged in to post a comment.
Okay, this looks tricky, but I think it’s possible.
user-new.php
file callswp_dropdown_roles()
to output the list of roles.wp_dropdown_roles()
function callsget_editable_roles()
to get the list of roles to output.get_editable_roles()
function has a filter,editable_roles
.So, you should be able to add a filter for
editable_roles
, such that, if the current page isuser-new.php
, you unsetadministrator
from$editable_roles
.Edit
This is completely untested, but should get you in the right direction. I’m assuming that
$editable_roles
is an array of user roles, e.g.array( 'subscriber', 'author', 'editor', 'administrator' )
, but I’ve not verified.Caveat: This isn’t turn-key code, but rather is merely example code. If you’re not comfortable grokking it to get where you need, then I wouldn’t recommend using it for copy-pasta.