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 simply want to add some php in as a custom link in the wordpress menu section. The code I want to use is <?php bp_loggedin_user_domain(); ?> which will generate that logged in user's buddypress profile page url. However, when I paste that in as a custom links, wp removes the opening and closing tags and removes all the white space.

Any ideas?

share|improve this question

closed as off-topic by kaiser Aug 4 '14 at 14:31

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.

You could do something like this:

if ( is_user_logged_in() ) {
     wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) );
} else {
     wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) );


Here is another try, same theory but different execution:

if ( is_user_logged_in() )
    // Filter wp_nav_menu() to add additional links and other output
    function new_nav_menu_items($items) 
        $homelink = '&lt;li class=&quot;home&quot;&gt;&lt;a href=&quot;' . bp_loggedin_user_domain() . '&quot;&gt;' . __('Profile') . '&lt;/a&gt;&lt;/li&gt;';
        $items = $homelink . $items;
        return $items;
    add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );
share|improve this answer
no I don't want different menus if user logged in or out, I want to generate the custom link that the function bp_loggedin_user_domain() outputs. – Nicola Sep 18 '12 at 20:17
Please check if the edit works. – Martin Hasan Sep 18 '12 at 22:48

Try using BP Menus plugin. It will add Buddypress menu items to Wordpress Menus and enable you to customize the menu from the dashboard.

share|improve this answer

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