Skip to content

Commit 11c051a

Browse files
committed
Disable dashboard access
1 parent 012df1e commit 11c051a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Users/disable-dashboard-access.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
add_action('admin_init', 'my_disable_dashboard_access');
4+
function my_disable_dashboard_access() {
5+
if(!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
6+
wp_redirect(esc_url(home_url('/')));
7+
exit;
8+
}
9+
}

0 commit comments

Comments
 (0)