[WP Hack] Prevent Admin Access for Logged in Users
WPAssist / WordPress Hacks - April 8, 2020For some webdesign projects, you may need to prevent admin access for logged in users. To do so, simply paste following snippet to your functions.php file: function prevent_admin_access() { if ( false !== strpos( strtolower( $_SERVER[‘REQUEST_URI’] ), ‘/wp-admin’ ) && !current_user_can( ‘administrator’ ) ) wp_redirect( […]