# Block Password Resets for Administrators

> Disables the "Lost your password?" flow for administrator accounts, which closes off reset-email based takeovers of the most powerful accounts.

- Type: PHP
- Runs: Run everywhere
- Category: [Login](https://wpide.com/library/category/login/)
- Tags: password, reset, security
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/block-password-reset-for-administrators/

## Code

```php
add_filter( 'allow_password_reset', function ( $allow, $user_id ) {
    return user_can( $user_id, 'manage_options' ) ? false : $allow;
}, 10, 2 );
```

## Notes

Administrators can still change their password from their profile, and another administrator or WP-CLI can reset it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Block Password Resets for Administrators" 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/
