Search code examples
phpwordpressbuddypress

Buddypress bp_core_new_nav_item() function not working to create new navigation item under ”my profile” tab


So I’m trying to add a new navigation under the “my profile” tab in buddypress once a user logs in. I created and am using the bp-custom.php file in my wp-content/plugins directory (outside of the buddypress directory) to insert the custom code. This is the code I have in bp-custom.php file (and that’s all I have!)

  <?php
  //place for custom buddypress functions
  bp_core_new_nav_item( 
  array( 
    'name' => 'feedback', 
    'slug' => 'Feedback'
  ));

  ?>

I got the following error in my browser. ————————– Server error The website encountered an error while retrieving http://myhostname.com It may be down for maintenance or configured incorrectly ————————— I am using the frisco for buddypress theme, not sure if this is part of my problem. What can I do to fix this error? (move bp-custom? misuse of function? theme incompatibility?) I will rate you up if you give me the correct answer. Thanks in advance! -Alex


Solution

  • Please use this one:

    bp_core_new_nav_item( array(
        'name' => __( 'My Links', 'bp-my-links' ),
        'slug' => 'my-link',
        'position' => 80,
        'screen_function' => 'bp_my_link_screen_my_links',
        'default_subnav_slug' => 'my-link'
    ) );
    

    Please put this code and see the under my profile tab there it will display the new "My Link" menu.