# Hide the All in One SEO Box From Authors and Contributors

> Removes the AIOSEO settings box from the editor for users who cannot publish pages.

- Type: PHP
- Runs: Admin only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: aioseo, admin, roles
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/aioseo-hide-metabox-roles/

## Code

```php
// Users without this capability do not see the box.
$wpide_aioseo_cap = 'publish_pages';

add_action( 'add_meta_boxes', function () use ( $wpide_aioseo_cap ) {
    if ( current_user_can( $wpide_aioseo_cap ) ) {
        return;
    }

    foreach ( get_post_types( array( 'show_ui' => true ) ) as $post_type ) {
        remove_meta_box( 'aioseo-settings', $post_type, 'normal' );
    }
}, 100 );
```

## Notes

AIOSEO Pro's Access Control settings offer finer control.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the All in One SEO Box From Authors and Contributors" 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/
