By default, after installing WordPress, there is an Admin Bar at the top with options to quickly switch to the Admin Dashboard and publish posts, among other functions. However, not everyone likes it. This article teaches you how to remove this admin bar.

The image above shows the Admin Bar (administrator toolbar). Sometimes it may appear unattractive, so we might want to delete or hide it.
The method to remove the Admin Bar is as follows:Open the website Admin Dashboard, go to Appearance, edit the Theme, modify the functions file, and insert the following code.
// Hide Admin Bar
show_admin_bar( false );
The admin bar will be hidden on the Frontend. If you are unsure how to manually add code to the Theme functions file, you can use the following method to achieve it.
Reference:
https://developer.wordpress.org/reference/functions/show_admin_bar/Show admin bar only to administrators
// 对非 Administrator 用户均隐藏顶部工具条(Admin Bar)
function my_function_admin_bar($content) {
return ( current_user_can( 'administrator' ) ) ? $content : false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');// 只对有管理权限的用户显示顶部工具条(Admin Bar)
if ( ! current_user_can( 'manage_options' ) ) {
show_admin_bar( false );
}Another way to hide the toolbar without modifying code:If you find adding code troublesome, you can also set whether to display the toolbar on the Frontend by modifying your profile page.

Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.