Blocking users from admin is no longer working
-
Hello, I’ve been useíng this code to block everyone that’s not an admin user from the admin area.
add_action( 'init', 'blockusers_init' ); function blockusers_init() { if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { wp_redirect( home_url() ); exit; } }
But with WP version 6.1.1 The code is no longer works. It redirects the users too many times so the site break. Can anyone help me with this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Blocking users from admin is no longer working’ is closed to new replies.