Add Custom Admin Notices in WordPress

WhatsApp’s new feature ‘Delete for Everyone’
November 1, 2017
Top 5 Best Free WordPress Maintenance Mode Plugins
November 30, 2017

On WordPress Admin space, you may encounter “admin notices” that allow you recognize regarding errors, updated settings, needed actions etc. It depends on WordPress plugins and themes to provide any custom notices that may be required. Admin notices are used by WordPress core, themes, and plugins to display warnings, notices, and important on-screen information to users. WordPress uses admin notices to alert users about errors, warnings, and success messages. If you are working on a website for clients who are not conversant in WordPress, then you will add admin notices to show useful info on their WordPress admin space.

Four types of admin notices –

  1. Success – displayed when something good happens, like settings updated successfully
  2. Error – displayed when an error or something bad happens
  3. Warning – displayed when the user should be warned of something
  4. Information – displayed to communicate information to the user

Steps to Add Custom Notices to WordPress –

This method requires you to add code to your WordPress site. First, you need to add code to your theme functions.php file –

  • Success Notice – For Success notice, you need to add the following code to your functions.php file of your theme. The success message displayed with a green border. ‘admin_notices’ is used to Prints admin screen notices. The hook function should echo a message to be displayed.



  • Error Notice – The error message displayed with a red border. Add the following code to functions.php file.



  • Warning Notice – The warning message displayed with a yellow border. Add the following code to functions.php file.



  • Information Notice –  The info message displayed with a blue borderAdd the following code to functions.php file –



Display notices on Different Screen –

  • If you want to display notices on the general setting page then this code displays a notice on the settings page with a yellow border.


Thanks for reading this blog post. Stay continue with us for the more interesting blog post.

Leave a Reply

Your email address will not be published. Required fields are marked *