Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Add Warning Notices for your Clients in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Add Warning Notices for your Clients in WordPress

As a consultant, developer, or designer, sometimes you just get hired to do the project and leave. Often in these circumstances, many developers customize the WordPress admin area and remove all the main settings options, so the client cannot break the site. However, it is really frustrating when another developer comes in just to find out that he has to take out bunch of code to see the settings. Or even if the owner decides they want to do things themselves, they don’t have the freedom to do so. The whole point of WordPress is to empower the publisher and give them freedom to publish content the way they want. Therefore in this article, we will show you how to give your clients full administrative access, but include warning notices for them, so they know the consequences of their actions. By simply hooking into WordPress admin_notices hook, we can display a notice that may say “Warning – changing settings on this page may cause problem with your website’s design”.

Warning Notices for your Clients in WordPress

First open your theme’s functions.php file, and then paste the following:

add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen;</div>
     if ( $current_screen->parent_base == 'options-general' )
          echo '<div><p>Warning - changing settings on these pages may cause problems with your website’s design!</p></div>';

You can modify the notices for each screen.

Thanks to Jacob Goldman for pointing this trick out. This will be great for our clients.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Dean Oakley says:

    There is a superfluous /div and you need the classes. See here

    add_action( 'admin_notices', 'my_admin_notice' );
    function my_admin_notice(){
         global $current_screen;
         if ( $current_screen->parent_base == 'options-general' ){
              echo '<div class="updated" ><p>Warning</p></div>';
              echo '<div class="error" ><p>Error</p></div>';
  2. Ibadullah says:

    I tried to remove the but still not working!

  3. bsgies says:

    Same error as Connor

  4. Connor Crosby says:

    I got the following error when I pasted that into my functions.php:
    Parse error: syntax error, unexpected ‘<' in …/wp-content/themes/1826store/functions.php on line 14
    So, I had to remove the div on line 3.

  5. Martin says:

    This is an extremely usefull piece of script which will come in handy for warning my clients not to mess with every setting:-).


  6. Konstantin says:

    OR you could use the WordPress Settings API:
    add_settings_error() and settings_errors()

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.