Advertisement
Guest User

Untitled

a guest
May 20th, 2010
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. //define admin menu function
  2.  
  3. function admin_menu_restriction() {
  4.     global $current_user;
  5.     if (current_user_can('manage_options')) { }
  6.     else{
  7.         $pageURL = 'http';
  8.        
  9.         //https restriction
  10.        
  11.         if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  12.             $pageURL .= "://";
  13.         if ($_SERVER["SERVER_PORT"] != "80"):
  14.             $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  15.         else:
  16.             $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  17.         endif;
  18.    
  19.         // redirect to 404 Page
  20.         {
  21.             header("Location:".get_bloginfo('url')."/404.php");
  22.         }
  23.     }
  24. }
  25.  
  26. add_action('admin_init', 'admin_menu_restriction');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement