I'm Rituraj, a Developer @Nagarro. founder of Maddyzone. JavaScript, Angular, Node.

Buy Me a Coffee at ko-fi.com

Add menu externally to wp menu list

For add menu externally in wordpress menu list add below code in your functions.php

add_filter( 'wp_nav_menu_items', 'myaccount_login_menu_item', 10, 2 );
function myaccount_login_menu_item ( $items, $args ) {
    if ($args->theme_location == 'secondaryhome') {
        $logout = wp_logout_url(site_url('?page_id=22'));
       $items .= '<li><a href="'.$logout.'">Logout</a></li>';
    }
    return $items;
}

where ‘secondaryhome’ is your menu name and $logout is your link herf

how to register a custom menu ;-

go to your functions.php

search for with named themename_setuup() function

add below code

register_nav_menu( 'secondaryhome', __( 'Secondary Navigation Menu', 'themename' ) );

Rituraj Ratan

I'm Rituraj, a Developer @Nagarro. Founder of Maddyzone .