WordPress Code Snippets

A fresh mix of code snippets and tutorials

WordPress Dismissible Admin Notice

261

Here is an easy snippet for adding a dismissible admin notice to any theme or plugin.

Update: I’ve written a complete guide to WordPress Admin Notices over at DigWP.com!</update>

Just add the following to your theme’s functions.php file, or to your plugin:

Once in place, this snippet will add a dismissible update alert notice at the top of each page in the WordPress Admin Area. The notice will include a link that each user can click to dismiss permanently.

That’s all there is to it, should be entirely plug-n-play, although you’ll probably want to customize the actual alert message (in the shapeSpace_plugin_notice() function).

Learn more

WordPress Themes In Depth


Show Support

Like our new Facebook Page to show support!