WordPress.org

Ready to get started?Download WordPress

Codex

Plugin API/Action Reference/admin notices

This page is marked as incomplete. You can help Codex by expanding it.

Description

Notices displayed near the top of admin pages. The hook function should echo a message to be displayed.

Example

function my_admin_notice() {
    ?>
    <div class="updated">
        <p><?php _e( 'Updated!', 'my-text-domain' ); ?></p>
    </div>
    <?php
}
add_action( 'admin_notices', 'my_admin_notice' );

The class "updated" will display the message with a white background and a green left border (used to be a yellow background before WordPress 3.8.).

The class "error" will display the message with a white background and a red left border (used to be a red background before WordPress 3.8.).

The class "update-nag" will display the message with a white background and a yellow left border. In addition, the message will be moved above the page title (<h2>).

Related