Skip to main content
Articles

Ban WordPress Admins From Making More Admins

26
0

Every once in a while, you run into that situation—someone insists on admin access. Not just anyone, but someone the client specifically asked you to add, so pushing back isn’t really an option.

You can already see where it’s headed. You know it’s probably going to turn into a mess… but you grant access anyway.

Fast forward a few months, and sure enough—admin access has spread like wildfire. More users have been added, others have been promoted, and suddenly control of the site feels a little… loose.

Fortunately, there’s a way to put a stop to that.


 // Prevents promoting anyone to admin
 add_filter( 'editable_roles', function( $roles ) {

  unset( $roles['administrator'] );
  
  return $roles;
 } );