Admin Warning Notice


/ Published in: PHP
Save to your folder(s)

Clients often expect full administrative access (and rightly so), including access to settings pages. Let’s look at how we can hook admin “notices” (those warning boxes generated by some plug-ins) to send some warnings to administrative users when they are on settings pages.


Copy this code and paste it in your HTML
  1. /* Admin Settings Page Warning */
  2. add_action( 'admin_notices', 'my_admin_notice' );
  3. function my_admin_notice(){
  4. global $current_screen; ?> <div>
  5. <?php if ( $current_screen->parent_base == 'options-general' )
  6. echo '<div style="background-color:lightYellow;padding:10px;margin-top:20px;border-width:1px;border-style: solid;border-color:#E6DB55;padding: 0 .6em;margin: 5px 15px 2px;-moz-border-radius: 3px;-khtml-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;"><p>Warning - changing settings on these pages may cause problems with your website\'s design!</p></div>';
  7. }

URL: http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.