Display custom message on wordpress admin

by in on

In some point of view when we developed a custom WordPress plugin or theme, we have to notify users for any urgent update, error or any custom message on WordPress admin section. All this done by admin_notices hook function.

Admin Notices

In this post I am going to create a simple plugin to display custom message, but if you want then you can do it with functions.php file. But displaying a message every time is irritating the user, so in this plugin i also gives the functionality to hide your custom message with the Hide this notice button. This button completely hide your notice.

[php]

 

As you see above plugin codes on line wp_enqueue_style( 'om_notice_style', plugins_url( '/om-dashboard-message/assets/css/custom_style.css' ) );, i have enqueue a custom style for our message. Below is the style for your message.