How To Show An Urgent Message In WordPress Admin Area
Today’s helpful tip comes from the people behind WPDoctors and it’s a nifty ready-to-use WordPress action hook that displays a custom message to admins that indicates urgency. This is helpful in situations where you need your message recipients to take immediate action on admin-related concerns.
function showMessage($message, $errormsg = false){ if ($errormsg) { echo '<div id="message">'; } else { echo '<div id="message">'; } echo "<p><strong>$message</strong></p></div>"; } function showAdminMessages() { showMessage("You need to upgrade your database as soon as possible...", true); if (user_can('manage_options') { showMessage("Hello admins!"); } } add_action('admin_notices', 'showAdminMessages');