• I found this code the other day, it adds a login/logout link in the navigation menu when using menus. It works fine, but I was wondering how I could also add a link to dashboard, as well as style it if possible. I can’t figure out the proper class to use.

    add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
    function add_login_logout_link($items, $args) {
    
            ob_start();
            wp_loginout('index.php');
            $loginoutlink = ob_get_contents();
            ob_end_clean();
    
            $items .= '<li>'. $loginoutlink .'</li>';
    
        return $items;
    }
  • The topic ‘Loginout in nav menu with functions’ is closed to new replies.