Admin menu link with variable
You can use wp_get_current_user() function to retrieve user login data. Also use get_edit_profile_url() to get profile page link. Note: You can use wp_logout_url() function for logout url. Try following code: add_action( ‘wp_before_admin_bar_render’, ‘wpdd_admin_bar_edit’ ); function wpdd_admin_bar_edit() { global $wp_admin_bar; // Show username with profile link $current_user = wp_get_current_user(); $username = $current_user->user_login; $profile_link = get_edit_profile_url(); $wp_admin_bar->add_menu( … Read more