Codex tools: Log in
Notices displayed near the top of admin pages. The hook function should echo a message to be displayed.
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 yellow background.
The class "error" will display the message with a red background.