Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //define admin menu function
- function admin_menu_restriction() {
- global $current_user;
- if (current_user_can('manage_options')) { }
- else{
- $pageURL = 'http';
- //https restriction
- if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
- $pageURL .= "://";
- if ($_SERVER["SERVER_PORT"] != "80"):
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
- else:
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
- endif;
- // redirect to 404 Page
- {
- header("Location:".get_bloginfo('url')."/404.php");
- }
- }
- }
- add_action('admin_init', 'admin_menu_restriction');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement