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;
}
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.