Adding a Site Login/Logout Link to an existing Menu in WordPress

Add Login Logut To Menu

You can add on to the end of an existing WordPress menu a site login/logout link. The WordPress menu must be registered and have a theme location, this will not work with custom menus. This needs to be added to your theme functions.php file add_filter( ‘wp_nav_menu_items’, ‘themeprefix_login_logout_link’, 10, 2 ); function themeprefix_login_logout_link( $items, $args ) { if(…

Read More

Add WooCommerce MyAccount Page Login/Logout to Menu

This code adds a login/logout link to your WordPress primary menu to log the user into the WooCommerce My Account page and then also log out to the same or different page. It differs from the referred article as that adds the WordPress default login/logout page. The menus need to be registered via register_nav_menu and positioned with theme_location,…

Read More