I used this function to display a log out link below the home icon. But how could I put a variable, for instance the current username, on that link to show a profile page?
The function is:
add_action( 'wp_before_admin_bar_render', 'wpdd_admin_bar_edit' );
function wpdd_admin_bar_edit() {
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
'parent' => 'site-name',
'id' => 'log-out',
'title' => __( 'Log out' ),
'href' => 'https://example.com/wp-login.php?action=logout',
));
}