Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Block user from accessing /wp-admin

@yliya14

Participant

`function wph_noadmin() {
if (is_admin() && !current_user_can(‘administrator’)) {
wp_redirect(home_url());
exit;
} }
add_action(‘init’, ‘wph_noadmin’);

Add this code to function.php The code redirects all users except the administrator to the main page of the site when they try to login to the admin panel

Skip to toolbar