How to Add Warning Notices for your Clients in WordPress

53

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.