Add a setting to RSA to hide the admin bar for subscriber users on the FE
This is a common need for previewing sites to low access users.
CC: @jeffpaul this came up for us on the fdc project. Might be a nice little enhancement here
@fabiankaegy given some sites have other various roles created, do you think this should be something like "display the admin bar for these user roles"? Maybe even targeting specific capabilities (perhaps too technical for most site owners)?
@jeffpaul yeah I think targeting edit-posts should be a good default. Maybe with a filter?
And just because it caused issues for us:
We need to make sure that the --wp--admin-bar--height variable is also nulled out / removed. This didn't work for us in our naive implementation
@jeffpaul @fabiankaegy
We need to make sure that the --wp--admin-bar--height variable is also nulled out / removed. This didn't work for us in our naive implementation
I don't think we need this, because show_admin_bar filter will take care of it. as you can see it in the method - is_admin_bar_showing() - that contains this filter.
The class - class-wp-admin-bar.php - won't load if that filter return false, as it is shown here in this method: _wp_admin_bar_init().
That class handles the logic for enqueueing the CSS/JS related to the admin bar functionality: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-admin-bar.php#L72-L73