Viewing 6 replies - 1 through 6 (of 6 total)
  • Try this.

    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;
    }
    Thread Starter Myntekt

    (@myntekt)

    That worked. Thank you 🙂

    No problem.

    Thread Starter Myntekt

    (@myntekt)

    Just another thing. I don’t know PHP but I do somewhat get what is happening in the code. I don’t understand what the 10,2 thing is. Could you explain that if it isn’t too complicated?

    To be honest with you I don’t really know what the 10,2 is either. I just found that code on the internet. I would think it would have something to do with the placement although I am not sure.

    Thread Starter Myntekt

    (@myntekt)

    Hm.. ok

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Login/Logout button on menu’ is closed to new replies.