如何从管理员以外的其他用户隐藏wp-admin,他们得到的应该在wordpress上出现HTTP 404错误?

I am designing my website on wprdpress. So to make it more secure I want this. if any user other than the administrator types on browser wp-admin after my domain name e.g "www.mydomain/wp-admin" should get a HTTP 404 error. How to get this please help.

 add_action('admin_init', 'no_mo_dashboard');
function no_mo_dashboard() {
  global $wp_query;
  if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
  $wp_query->set_404();
  status_header( 404 );
  get_template_part( 404 ); exit();
  }
}

Paste the above code in functions.php. This restricts normal user access to dashboard and redirects to 404 page.

Hope this helps.

You can do this using ip addresses if you have them for the specific user's accounts. You can restrict address using the .htaccess file see this redirect to 404 but you would have to know users ip address. You wouldn't be able to access it from outside your regular space either, like starbucks.