Show Urgent Messages In WordPress Dashboard

If you use WordPress dashboard then I'm sure you would of noticed the error messages that are displayed at the top.

These will normally be messages from WordPress to let you know a new version has come out and it's time to upgrade you current version. wordpress-update

These messages can be really be useful to WordPress developers as you can let your users know about changes you are currently making. Using the below snippet you can add a Message to the dashboard, these can either be error messages or just a notice messages.

Add the following to the functions.php file to add the error messages or notice messages.

function showMessage($message, $errormsg = false)
	if ($errormsg) {
		echo '<div id="message" class="error">';
	else {
		echo '<div id="message" class="updated fade">';
	echo "<p><strong>$message</strong></p></div>";
function showAdminMessages()
    showMessage("Welcome to the new WordPress theme.", true);
add_action('admin_notices', 'showAdminMessages');
Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial