I’m trying to use this code:
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
if( $args->theme_location == 'top-menu' ) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
}
return $items;
}
However I cannot work out what my main menu is called. It is not ‘top-menu’ as per the above. What is the name of this menu? Thanks
Yes, that worked! Thank you.