When you login to wordpress with any account, as long as that account has the task of administering your website, such as author, editor, etc., outside the homepage will appear a black Admin bar. lying on the head. This Admin bar will not appear to members who register for an account outside the front-end, or customers. Because these people simply do not have access to the admin page, this page will be hidden when they log in.

The Admin bar will help administrators quickly access the tasks inside the Dashboard. It sounds convenient, but for me, I rarely use this bar. So I find it quite annoying. If you are someone who doesn’t like the Admin bar like me, then go for it by simply adding the following line of code to the function file :
show_admin_bar(false); <div><span>1</span></div>
The above simple code will turn off the Admin bar for all users. However, if you only want to turn it off for other members, the Admin still leaves it visible, so you can use the following code:
add_action('after_setup_theme', 'remove_admin_bar');
<samp>function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
</samp><div>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span>
</div>
Using this code, the Admin bar is only visible to admin, and hidden to other members. And this is the result:

Bonus for you another admin bar related tip. You see in the right corner of the Admin bar it has a greeting, such as Howdy, admin or Hello, admin or if using Vietnamese WordPress it is Hello, admin . Now I change this word Hello to another word for fun, then use the following code:
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Chào,', 'Hello anh đẹp trai:', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );
<div>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span>
</div>
In the above code, I changed the word Hello, to Hello handsome guy: offline. It will work with the Admin bar outside the Front-end as well as in the Dashboard. Like that:


