Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
// LOGOUT LINK IN MENU
function diww_menu_logout_link( $nav, $args ) {
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>';
if( $args->theme_location == 'primary' ) {
return $nav.$logoutlink ;
} else {
return $nav;
}
}
add_filter('wp_nav_menu_items','diww_menu_logout_link', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment