Hide administrator ToolBar in WordPress

There are a few ways how you can hide a toolbar in WordPress.
The toolbar is the menu in the top header where you are linked to a WordPress administration panel. An example may be seen below:

WordPress toolbar example

You can hide toolbar for selected users by visiting the menu in the WordPress > Users > All users > Select the user and uncheck the box ” Show Toolbar when viewing site”

If you would like to hide the toolbar for all the users except an administrator, you may use the following script:

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}

Paste this code in your theme’s functions.php which may be found in Appearance > Theme editor > functions.php

If you want to disable toolbar for all users, then simply use this code in your theme’s functions.php file:

show_admin_bar(false);

Also, you may find and install a plugin to hide admin toolbar, for example, https://wordpress.org/plugins/hide-admin-toolbar/