# Site-Wide Admin Notice

> Shows your own message at the top of every admin screen, for example "This is the staging site" or a reminder for editors.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin, notices, message
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/site-wide-admin-notice/

## Code

```php
$wpide_admin_notice = array(
    'message'    => '<strong>Heads up:</strong> content freeze until Friday. Please save changes as drafts.',
    'type'       => 'warning',    // info, success, warning or error.
    'capability' => 'edit_posts', // Who sees it.
);

add_action( 'admin_notices', function () use ( $wpide_admin_notice ) {
    if ( ! current_user_can( $wpide_admin_notice['capability'] ) ) {
        return;
    }

    printf(
        '<div class="notice notice-%1$s"><p>%2$s</p></div>',
        esc_attr( $wpide_admin_notice['type'] ),
        wp_kses_post( $wpide_admin_notice['message'] )
    );
} );
```

## Notes

Deactivate the snippet to remove the notice; it cannot be dismissed by users.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Site-Wide Admin Notice" 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/
