Notifications
Clear all

Script [Closed] Admin Bar for editors custom code?

2 Posts
2 Users
0 Reactions
2,271 Views
Posts: 1
Topic starter
(@willcrall)
New Member
Joined: 7 years ago

I'm curious if there is any work around with code or other means to allow the admin bar for editors without enabling for all members? 

Topic Tags
1 Reply
Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

You can use this code in your current active theme functions.php

function my_admin_bar_control_function() {
if (current_user_can('administrator') || current_user_can('editor') ) {
show_admin_bar(true);
} else {
show_admin_bar(false);
}
}
add_action('init', 'my_admin_bar_control_function', 20);

How to Easily Add Custom Code in WordPress (without Breaking Your Site)