Tagged: Admin Bar
Hi Buddydevs,
I added in function.php of my theme the following code to remove for the users the Admin bar as well as the Blank left after doing so on top of the page :
‘ add_action(‘after_setup_theme’, ‘remove_admin_bar_user’);
function remove_admin_bar_user() {
if (current_user_can(‘administrator’) || is_admin() ) {
show_admin_bar(true);
}else{
show_admin_bar(false);
}
} ‘it’s working for all the pages not directly controled by buddypress (home, blog,…) for the other pages (member, forum, …) nevertheless, if the admin bar is indeed removed, the blank remains. Could you help me on this ? What and where should I put some code to remove the blank on top between my header and the top of my page.
Many thanks in advance,
Cheers,
Hi Alexandre,
Please try hooking to ‘init’ section and it should work.Here is your code with init action
add_action( 'init', 'remove_admin_bar_user', 10001 ); function remove_admin_bar_user() { if ( current_user_can( 'administrator' ) || is_admin() ) { show_admin_bar( true ); } else { show_admin_bar( false ); } }
Does it work?
- This reply was modified 6 years, 11 months ago by
Brajesh Singh. Reason: Updated privacy to normal
- This reply was modified 6 years, 11 months ago by
Brajesh Singh. Reason: Updated priority to normal
- This reply was modified 6 years, 11 months ago by
It’s Working !
Many thanks for your quick and great answer,
Cheers,
The topic ‘ [Resolved] Disable BuddyPress Admin Bar and remove CSS blank for user’ is closed to new replies.