Skip to:

BuddyPress Profile Link

  • jbt103


    I want to create a “My Profile” link in one of my menus and I found the following code:

    // Filter wp_nav_menu() to add profile link
        add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
        function mme_nav_menu_profile_link($menu, $args) {
    	$profilelink = '<a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('My Profile', 'buddypress' ) . '</a>;
    	if (is_user_logged_in() && 'usernav' == $args->theme_location )
    		return $profilelink . $menu;
    		return $menu;
    add_filter( 'wp_nav_menu_items', 'mme_nav_menu_profile_link', 10, 2);

    I got a reply on WordPress Support but it gave me a blank screen and this person has given me a lot of help, I almost hate to keep asking but it still isn’t working. So I’m trying over here instead.

    The last code this person gave me was:

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'mme_nav_menu_profile_links', 10, 2 );
    function mme_nav_menu_profile_link($menu, $args) {
        if( is_user_logged_in() && $args->theme_location == 'usernav' ){
            $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '" rel="nofollow">' . __('My Profile') . '</a></li>';
            $menu = $profilelink . $menu;
        return $menu;

    That didn’t give me a white screen but all my menu’s disappeared.

    My site is and the menu I’m wanting the BuddyPress link for is ‘usernav’ it’s on the top next to the search bar. It’s only shown when members are logged in, otherwise ‘visitornav’ is shown.

  • The topic ‘BuddyPress Profile Link’ is closed to new replies.
Skip to toolbar