Categories
Code WordPress

BuddyPress: Remove a Sub Item from a Navigation Menu

This example demonstrates how to remove the Notifications item from the BuddyPress Setting default navigation menu.

This example demonstrates how to remove the Notifications item from the BuddyPress Settings default navigation menu. Simply add the code below to your theme’s functions.php file.

<?php
// Remove Settings->Notifications SubMenu
function skw_remove_notifications_subnav(){
global $bp;
if ( $bp->current_component == $bp->settings->slug ) {
bp_core_remove_subnav_item( $bp->settings->slug, 'notifications' );
}
}
add_action( 'wp', 'skw_remove_notifications_subnav', 2 );

Here is a similar example that could be used to remove the System Notices menu from the Messages section.

<?php
// Remove Messages->Notices
function skw_remove_notices_subnav() {
global $bp;
if ( $bp->current_component == $bp->messages->slug ) {
bp_core_remove_subnav_item( $bp->messages->slug, 'notices' );
}
}
add_action( 'wp', 'skw_remove_notices_subnav', 11 );

3 replies on “BuddyPress: Remove a Sub Item from a Navigation Menu”

Thanks for this! It’s almost what I was looking for.

Can you help me to remove the “General” subnav menu? The problem is that its the default subnav menu under “Settings”, so it can’t be removed in this way. I don’t want users changing their passwords / usernames from bbpress. This is controlled somewhere else.

I suppose the default subnav menu under Settings should be changed to Notifications, and then General can be removed. What do you think?

Anyway.. I’m going to look into it. I hope there’s a solution.

Thanks!
Mike.

That was nice, it removed the notice from bp message section. how about if you want to remove the starred, sent and compose tab also? Any help would be appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.