Add a Warning notice to the WordPress Admin

by Dan
Last updated: September 26th, 2020

This is a useful snippet that has a number of uses. I’ve used it in the past to remind clients of scheduled maintenance and even once as an effective (yet friendly) reminder that a clients invoice is outstanding. I rarely reach for this one, but it’s useful to have available should the need arise.

function author_admin_notice(){ global $pagenow; if ( $pagenow == 'index.php' ) { echo '<div class="notice notice-error"> <h1><strong>Schedule Maintenance</strong></h1> <p>This is a friendly reminder that we will be carrying out some technical updates on the website on Thursday at 9am.</p> <p>The maintenance will last for around an hour. Please refrain from making changes during this time.</p> </div>'; } } add_action('admin_notices', 'author_admin_notice');

we think you'll probably like these too