This is a guide how to add a link to the WordPress menu with dynamic generated username.

This example is to use when having generic user page, here named /profile/. If you do not use a generic made profile page and want a dynamic link to author page, you can try switch it to /author/, not sure if it works. Test it and let me know.

function my_custom_menu_item($items, $args)
{
if(is_user_logged_in())
{
$user = wp_get_current_user();
$name = $user->user_login; // or user_login , user_firstname, user_lastname
$items = str_replace(‘”http://yourwebsite.com/profile/”‘, ‘”http://yourwebsite.com/profile/’.$name.’/”‘, $items);
}
return $items;
}
add_filter( ‘wp_nav_menu_items’, ‘my_custom_menu_item’, 10, 2);