# Block Reserved Usernames

> Prevents anyone from registering or being created with usernames like admin, support or root that look official or invite attacks.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: users, registration, security
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/reserved-usernames/

## Code

```php
// 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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Block Reserved Usernames" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
