Block Reserved Usernames
Prevents anyone from registering or being created with usernames like admin, support or root that look official or invite attacks.
Opens WPIDE on
Code
// Usernames nobody may use (case-insensitive).
$wpide_reserved_usernames = array( 'admin', 'administrator', 'root', 'support', 'help', 'webmaster', 'info', 'test', 'sysadmin', 'wordpress', 'owner', 'staff' );
add_filter( 'illegal_user_logins', function ( $logins ) use ( $wpide_reserved_usernames ) {
return array_unique( array_merge( (array) $logins, $wpide_reserved_usernames ) );
} );
Notes
Existing users with these names are not affected.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.