Specify Menue – Add “edit profile”
-
Hi,
Is used the code snippet from the codex and it worked fine.
How could I modify the code to choose a specific menu?
E.g. primary oder secondary. Actually “Edit Profil” is shown in all my menues and I just want to have it on my Primary Menu.
// Filter wp_nav_menu() to add profile link add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' ); function my_nav_menu_profile_link($menu) { if (!is_user_logged_in()) return $menu; else $current_user = wp_get_current_user(); $user=$current_user->user_login ; $profilelink = '<li><a href="/forums/users/' . $user . '/edit">Edit Profile</a></li>'; $menu = $menu . $profilelink; return $menu; }
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.