Beginner's Guide for WordPress / Start your WordPress Blog in minutes

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

6 CommentsLeave a Reply

  1. 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. 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.

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


Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.