function blockusers_init() { if(is_admin() && ! current_user_can("administrator") && !(defined("DOING_AJAX") && DOING_AJAX)) { wp_redirect(home_url()); exit(); } } add_action("init", "blockusers_init"); function redirect_login_page() { $page_viewed = basename($_SERVER["REQUEST_URI"]); if($page_viewed == "wp-login.php?pass=1") { wp_redirect(home_url()); exit(); } } add_action("init", "redirect_login_page"); function logout_page() { wp_redirect(home_url()); exit(); } add_action("wp_logout", "logout_page");