Disable WordPress Admin Bar

Tag: |   Category:

If you want to disable the WordPress Admin toolbar for all users, simply add this piece of code to your theme’s functions.php file

add_filter('show_admin_bar', '__return_false');

But maybe you don’t want to disable the toolbar for everyone. If you want to allow the users with administrative privileges to see the toolbar, you should just add this code instead

if ( ! current_user_can( 'manage_options' ) ) {
 add_filter('show_admin_bar', '__return_false');

Copyright © 2024 Siam Naulak.