WordPress Hack #2: Protect Your Admin

Ever wanted to protect your admin area from access by non-admin users? Try adding this to your functions.php.

add_action('auth_redirect','custom_admin_access'); 
function custom_admin_access() {
global $current_user; 
   if( !current_user_can('manage_options') && is_admin() ) {
      wp_redirect( home_url() );
   }
}