WordPress Function to Add a Login Link to wp_nav_menu

Add a Login Link to wp_nav_menu

//ADD LOGIN LINK TO MENU
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

function add_login_logout_link($items, $args) { 

        $loginoutlink = wp_loginout('index.php', false); 

        $items .= '<li>'. $loginoutlink .'</li>'; 

    return $items; 
}

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *