Display Alert or Error Message on Admin Pages

You know those error messages you sometimes see at the top of WordPress admin pages?  Sometimes they’re helpful, other times not so much.  But, its really easy to add them to a theme or plugin.  I’ve used them to prompt users to check a setting when the theme or plugin is first installed.

Call it from another function to produce an error message or alert based on user action.  Leave it as-is for a constant reminder (such as late payment notices).

Add to functions.php file or plugin.

 

Dave Winter focuses in WordPress UI Design and WordPress Plugin Development (some have labelled him a fanatic) but has hands in many other projects, including photography and music. He's never far from a computer... or an iPad (for testing purposes, of course). If you've been to a WordCamp in Southern California, he probably already knows who you are (or maybe not - he's terrible with names). Dave currently teaches courses at California State University, Long Beach alongside his small business at dauid.us (and his students think he's pretty boss).
© 2008-2018, dauid.us