Custom BuddyPress Profile Menu: Add & Remove BP Menu Pages

BuddyPress Menu Components

In our previous BuddyPress Profile Menu tutorial, we provided examples to change the default BP menu and subnav names and positions. In this tutorial, we cover how to add complete new profile pages to the BP user menu, including submenu items, and how to remove default nav items entirely.

  1. Remove Default BP Menu Items
  2. Adding New Profile Nav Items
  3. Attach Profile Pages / Screen Functions

Remove Unwanted Default Profile Menu Items

The best way to disable/remove a menu item in the BP members profile, is to disable the component from the BuddyPress Settings. This guarantees that not only would the menu items not display, but its pages would no longer exist, which could still be accessed directly via its URL.

In a scenario where you'd like to remove a menu item from the BuddyPress profile, but would like to keep the component enabled, e.g. Forums, Site Tracking, then the safest way is to use the unset function:


Simply apply this function to the bp_setup_nav action, as explained in the previous BuddyPress tutorial (we will show a complete function below).

Adding New Profile Nav Items

To add completely new items to the profile navigation, we will use the bp_core_new_nav_item function. The function has multiple parameters, which are described here.

Let's use this code to add a new profile menu item that we will use to display a users posts:

add_action('bp_setup_nav', 'mb_bp_profile_menu_posts', 301 );
function mb_bp_profile_menu_posts() {
global $bp;
        'name' => 'My Posts',
        'slug' => 'posts', 
        'position' => 11, 
        'default_subnav_slug' => 'published', // We add this submenu item below 
        'screen_function' => 'mb_author_posts'

The code will add a menu item right after the first default menu item (after the Activity tab) and it will attempt to display the content from the mb_author_posts function.

Assigning New Subnav Items

To attach a subnavigation to our new menu item, we will use the function bp_core_new_subnav_item and add it to the action bp_setup_nav after the function to create the parent menu tab has run:

add_action('bp_setup_nav', 'mb_bp_profile_submenu_posts', 302 );
function mb_bp_profile_submenu_posts() {
	global $bp;
	if(!is_user_logged_in()) return '';
bp_core_new_subnav_item( array( 
	'name' => 'Published',
	'slug' => 'published', 
	'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/'; ,
	'parent_slug' => $bp->bp_nav['posts']['slug'],
	'position' => 10,
	'screen_function' => 'mb_author_posts'
bp_core_new_subnav_item( array( 
	'name' => 'Drafts',
	'slug' => 'drafts', 
	'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['posts']['slug'] . '/'; ,
	'parent_slug' => $bp->bp_nav['posts']['slug'],
	'position' => 20,
	'screen_function' => 'mb_author_posts_drafts'

Adding Profile Menu Tab Content

Now that we have our navigation items in place, we need to attach the functions that displays the content. We do this by attaching our functions content output to the BuddyPress template /members/single/plugins:

Here an example of how our function could look like:

function mb_author_posts(){	
	add_action( 'bp_template_content', 'mb_show_posts' );
	bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
function mb_show_posts() {
	echo 'Function to Generate the displayed users posts.';
	// echo do_shortcode('[mb_feedburner count=5 user="MaximusBusiness"]'); // Displays a shortcode output.
The shortcode example above has been taken from the tutorial Must Have WordPress Shortcodes.

You would duplicate the above structure for the second subnavigation item if applicable.

Feel free to comment or request more examples/explanations for any of the above.

I'm a developer at Maximus Business.
  • Anson
    Hi Thanks for the tutorial. I'm trying to follow your tutorial and put in the submenus....but when I do, and try to load the page, its blank, which I would guess (in safari) means server error.

    Said on Sep 22, 2013 by Anson - Reply
  • Gunn4r
    Great tutorial! Is there a hook to put more stuff on existing tabs? Like say I wanted to add some text on the Profile->View tab, do you know a good way to do that?

    Said on Oct 10, 2013 by Gunn4r - Reply
  • Charlie
    Hi there, thanks for the article. Is it possible to remove the top level menu items and just leave the sub items ? I have all the main options on my main menu, but so that I don't make that cluttered and would be good to just have the second level menu options when these are selected from my main menu.

    Said on Mar 19, 2014 by Charlie - Reply
  • Matilda H.
    Thanks for the tutorial. I also found a plugin called BuddyPress Custom Profile Menu that does all this automatically.

    Said on Apr 26, 2014 by Matilda H. - Reply
  • Patrik
    Hi Maximilian, I'd like to thank you for a great and fresh article (finally)! I've just tested adding profile menu tabs in default BuddyPress Default theme v. 1.9 + BuddyPress v. 2.0.1, WP v. 3.9.1 and it works fine. In my case I used WP User Frontend plugin, which is a great solution for users to add their content easy way. I have also tried plugin BuddyPress Custom Profile Menu, but it didn't work.

    Said on Jun 15, 2014 by Patrik - Reply
  • Saskia
    Hi, thanks for this great tutorial. I have played around with it and got working what I wanted. However I seem to have broken 2 of the default links and can't get them to work again. If I am on the users page on activity than we have 5 submenu's 3 I can click and works fine but two I used to experiment with your tutorial are now broken and always redirecting me to user/activity current component activity and current action just-me. I am working on this for a day now by looking in all the files that are called to where it went wrong. Even tried another theme and reinstalled Buddypress, but it won't work. I installed a wordpress with Buddypress in MAMP to see if it is a bug in Buddypress, but that one is working just fine. Please can you help me finding what is wrong????? Saskia

    Said on Aug 15, 2014 by Saskia - Reply
  • asif
    Hi Maximilian, Thanks a ton for this article. Tried you instructions but the sub menu is not displaying. Can you tell me what might be the issue. Very grateful for any help in this problem.

    Said on Sep 19, 2014 by asif - Reply
  • Vikas
    Hello, Your example is nice. I am little confused in which files i need to put code. Please describe the file path and names so that i can try this easily. Thank you very much

    Said on Nov 27, 2014 by Vikas - Reply
  • Vikas
    Hello, What i am trying to do is Putting new sub menu item under Activity Main Menu as good things as a sub menu item when i click on it it shows a custom page content. How can i achieve this.

    Said on Nov 27, 2014 by Vikas - Reply
  • Michael
    Hi, What file do we find/add these settings to? Thanks, Michael

    Said on Mar 28, 2015 by Michael - Reply

Leave a Reply

Please feel free to give us your feedback and comment below. Please keep in mind that comments are moderated. Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>