Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
adds login menu item to navigation
//add login to nav menu. wordpress example doesnt work! needed to play with it. login menu item added!
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if ($args->theme_location == 'primary') {
$loginout = '<li class="nav-menu menu-item loginout login-icon">' . wp_loginout($_SERVER['REQUEST_URI'], false ) . '</li>';
$items .= $loginout;
return $items;
return $items;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.