WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble adding sub nav menu items to my parent menu item under Buddy Press.

The parent menu item as shown below, named TEST, shows correctly, but the tabs named SUB NAV and SUB NAV 2 don’t show at all.

function my_setup_nav() { 
global $bp; 
$em_link = $bp->loggedin_user->domain . $bp->account->slug . '/';

# - add parent menu item    

bp_core_new_nav_item( array( 
    'name' =>  'TEST',
    'slug' =>  $bp->account->slug, 
    'position' => 10,

# - add sub nav menu items

bp_core_new_subnav_item( array( 
    'name' => 'SUB NAV',
    'slug' => 'account-sub', 
    'parent_url' =>  $em_link ,
    'parent_slug' => $bp->account->slug,
    'position' => 10,
    'item_css_id' => 'xx' 
bp_core_new_subnav_item( array( 
    'name' => 'SUB NAV 2',
    'slug' => 'account-sub-2', 
    'parent_url' =>  $em_link ,
    'parent_slug' => $bp->account->slug,
    'position' => 20,
    'item_css_id' => 'xx-2' 

add_action( 'bp_setup_nav', 'my_setup_nav', 99 );

What's the correct syntax for getting the Sub Navigation items to work correctly?

share|improve this question

closed as off-topic by toscho Aug 2 '14 at 21:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote -1 down vote accepted

Asked and Answered here: http://buddypress.org/support/topic/create-sub-nav-menu-item-in-profile/

Did you try the suggested solution ?

share|improve this answer
I tried adding the screen function with an empty test function to no avail. If I change the slug to $bp->profile->slug then the Sub Nav item appears as a sub item of the Profile Parent tab but seems not to work with my custom added "TEST" parent. It seems like its a slug issue, but whether I am declaring 'slug' => $bp->account->slug or 'slug' => 'account' it still doesn't seem to take. When I dump the $bp global, I can see my parent menu item exists as it should, so that doesn't seem to be the issue. Thanks for your input thus far. – userabuser Feb 9 '13 at 3:37
It turned out to be that the BP custom profile menu plugin was conflicting with my code or vice versa. Disabling that plugin now allows me to manually declare parent/child items correctly. Thanks for your help. – userabuser Feb 9 '13 at 6:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.