# Hide the Admin Bar for Subscribers

> Hides the toolbar on the front of the site for anyone who cannot edit posts, such as subscribers and shop customers. Authors, editors and administrators keep it.

- Type: PHP
- Runs: Run everywhere
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin-bar, toolbar, subscribers
- Author: WPIDE Team
- Installs: 11
- Updated: 2026-10-28
- Page: https://wpide.com/library/hide-admin-bar-for-subscribers/

## Code

```php
add_filter( 'show_admin_bar', function ( $show ) {
    if ( ! current_user_can( 'edit_posts' ) ) {
        return false;
    }

    return $show;
} );
```

## Notes

Change edit_posts to another capability (for example manage_options) to hide the bar for more roles.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the Admin Bar for Subscribers" 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/
