transmitstudio
8/14/2017 - 11:38 PM

Add login/logout to menu

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