Archived topic
Disable Admin Bar
9 replies · Started by Brennen on November 22, 2017
I am wondering if it is possible to disable the admin bar for specific pages of my choosing. I have tried to use CSS but it doesn't seem to work right and everything I try in JS disables it all the time and not on specific pages.
Hi there,
There are a few options in this post: https://generatepress.com/forums/topic/hide-admin-bar-for-all-users/
Give it a shot?
Thanks for the suggestion but those are for removing it all the time, I am only trying to remove it from a couple of pages.I recently tried `if ( !is_page('Landing') ) {
add_filter('show_admin_bar', '__return_false');
}` but it didn't work and removed it all the time, any suggestions on editing this code to get it to target the pages?
Maybe this?:
add_action( 'wp', 'tu_remove_admin_bar' );
function tu_remove_admin_bar() {
if ( ! is_page( 'Landing' ) ) {
add_filter( 'show_admin_bar', '__return_false' );
}
}
Just tried it and it still removed the admin bar on every page and not just the one page :(. Also when I disable it on mobile the menu gets pushed up and only half of it shows.
The ! in there makes it so it applies to every single page except for that one.
If you remove the !, it should only apply to the "Landing" page.
unfortunately its now showing on every page including 'Landing' even after I removed the !
Grr, just made another adjustment, can you give it another shot?
Thanks!
New code works great! Only problem is that on the other pages the admin bar shows up bank on mobile, but I have a feeling this is a setting in buddypress.
Ah yea - I think I've seen that before. Might be worth checking with their support.