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 am adding menu items with the code below, the menu items show up when clicked but they give damaged url's

e.g for the top link when clicked


clearly this

<?php return bp_loggedin_user_domain() ?>

is not being returned properly

Any help with this is greatly appreciated Thanks

function add_profile_link_to_nav($items) {
    if ( is_user_logged_in() )

return $items . 
 '<li class="myclass"><a href="<?php return bp_loggedin_user_domain() ?>activity/just-me/">My Wall</a>

<ul class="sub-menu">

 <li class="menu-item"><a href="<?php return bp_loggedin_user_domain() ?>activity/friends/">My Friends Activities</a></li>
 <li class="menu-item"> <a href="<?php return bp_loggedin_user_domain() ?>profile/edit/group/1">Edit My Profile</a></li>

add_filter('wp_nav_menu_items','add_profile_link_to_nav', 10, 2); 
share|improve this question
up vote 0 down vote accepted

Your <?php return bp_loggedin_user_domain() ?> is part of a string therefor it is not executed. You should probably have

'<li class="myclass"><a href="'. bp_loggedin_user_domain() .'activity/just-me/">My Wall</a> ...
share|improve this answer
Thank you, that was the problem, very grateful for your help. – Tim Jan 11 '13 at 0:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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