WordPress

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 ^

Join Paulund

  • Get access to 100s of premium tutorials and downloadable content
  • Members content consists of Premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • Priority email development support
  • No ads

Here at Paulund you'll find Web Development tutorials and snippets focusing mainly on PHP, WordPress and CSS. Members will get access to premium tutorials that go into more detail about development with these languages. You will also get access to downloadable premium content based on the tutorial.

Join Paulund

Leave a Reply

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