Do you want to remove buddypress admin bar from all blog except the blog on which buddypress is activated.
here is a small snippet of code that you can use to remove the buddypress admin bar.Put it into bp-custom.php
function remove_bpadminbar(){
global $current_site;
if($current_site->blog_id!=BP_ROOT_BLOG) //if current blog is not the one on which buddypress is activated
{
remove_action( 'wp_footer', 'bp_core_admin_bar', 8 );//remove buddypress admin bar
}
}
add_action("wp","remove_bpadminbar");
?>
You can put it into a file and drop in to mu-plugins directory or use put it inside bp-custom.php.
Happy social networking with Buddypress
and yeh,let me know in comments how it worked for you.
Related posts:
- Remove /blog slug from the default blog of wpmu subdirectory installation
- Disable Blog Posts and new Blog Comments recording/tracking In the activity by BuddyPress
- Stealth Mode for Buddypress Site Admin Plugin
- Playing With buddypress and WordPress, some codes for the site admins
- Allow Users to select a blog theme while signing up/creating a blog on your buddypress powered social network
Hi Brajesh,
I’ve been trying to adjust this code to my needs but with no luck
I’d have a single blog on a WP3.0 network site that I’d like the BP adminbar not to display on. The Blog ID = 3.
Can you please point me to a possible solution? Thanks in advance for your help.
Cheers
Paul
Hi Paul,
Thanks for the comment. Please change the line
if($current_site->blog_id!=BP_ROOT_BLOG)
to
if($current_site->blog_id==3)
and It should work for you. Please do let me know if it works or not.
Thanks
Brajesh
Thanks Brajesh,
unfortunately that didnt work.
here’s the code I used for your reference…
blog_id==3) //if current blog is not the one on which buddypress is activated
{
remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
}
}
add_action(“wp”,”remove_bpadminbar”);
?>
Sorry, that code didnt paste in correctly…..
blog_id==3) //if current blog is not the one on which buddypress is activated
{
remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
}
}
add_action(“wp”,”remove_bpadminbar”);
?>
@Paul
have you put the code in wp-content/plugins/bp-custom.php ?
Yes. wp-content/plugins/bp-custom.php
@Paul I dunno if you still check up on this but I think the reason yours doesn’t work is that “<?php" is missing from the beginning of the code snippet. Posting this for Googlers that got here like I did.
it should be:
blog_id!=BP_ROOT_BLOG) //if current blog is not the one on which buddypress is activated
{
remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
}
}
add_action(“wp”,”remove_bpadminbar”);
?>
Sorry I forgot the <?php too, go figure.