Add submenu with a custom link, /wp-login?action=logout, like the image below:
Add code like below in functions.php:
function wpa_remove_menu_item( $items, $menu, $args ) {
if ( is_admin() || ! is_user_logged_in() )
return $items;
foreach ( $items as $key => $item ) {
if ( 'Login / Register' == $item->title )
unset( $items[$key] );
if ( 'Logout' == $item->title ) {
$items[$key]->url = wp_logout_url();
}
}
return $items;
}
add_filter( 'wp_get_nav_menu_items', 'wpa_remove_menu_item', 10, 3 );
Related Posts:
- How to add menu to Dashboard that can be viewed by all users
- Add a logout menu link [duplicate]
- add the user name to menu when user is logged in [closed]
- wp_nav_menu log in/out link?
- do_action appearing outside of menu?
- ‘Users’ and ‘Appearance’ have disappeared from dashboard menu [closed]
- In the Admin Dashboard, can I choose which sections to display?
- Is it possible to add a dynamic link in the main navigation in a child theme
- how to remove description from menu buttons?
- WP admin style not refreshing
- How to Show Different Menus to Logged in Users in WordPress [duplicate]
- login logout menu changes in wordpress [closed]
- Menu page with three columns
- WordPress Login/Logout Single Menu Only
- Trying to add Newline in Menu item
- How to add Loginout to Sub-menu
- How to make Logout Link consistently appear on all web pages?
- Is it possible to remove the highlighted menu on Users and highlight a different menu?
- How do i make a custom top level dashboard menu item available for all users?
- change link of menu particular tab
- List of WordPress menu item indices?
- Create custom page and custom menu
- How to handle change the appearance of ‘categories’ box on dashboard?
- To Add Logout Button in Menu [duplicate]
- Change the menu home link to something else
- Make a navigation menu in the same post [duplicate]
- wp_list_pages sort order by custom nav menu order
- Prevent menu from loading in a page template [duplicate]
- How to use wp_nav_menu with hashtag links?
- Rename menu items for All except super admin
- Displaying Nav Menu
- Adding toggle-able element after menu item
- Get Menus In Header.php FIle
- Custom register_taxonomy ins’t showing custom Nav menu
- Conditional menus based on page title
- How to test if a specific page is the front page?
- Style wp_link_pages as a select drop down list
- Menu deletes all items and position – wordpress bug?
- Mobile navigation is shown, but standard navigation does not disappear
- Plugins & Setting Menu Items Removed From Admin Panel
- Responsive menu on genesis theme [closed]
- Question about Menus on WordPress
- How to add active class to separate page link?
- Controlling sub-menu within sub-menu
- Main menu navigation links and new pages
- Bootstrap menu – make menu entries with submenu not clickable
- How are methods of class Walker_Nav_Menu invoked?
- Duplicate menu items when auto generating menu from product categories
- Using menus to link to sections on the home page
- Multisite: menus can’t be added in child sites
- How to get the Page Name of the current page?
- Add/remove image from navigation bar
- Swap out a page that is a parent to a many many pages
- How can I order these pages in this navigation bar on this old wordpress theme?
- Adding widget to sidebar which contains current page’s submenu
- Modifying Woocommerce menu based on tags and categories
- How To add this tag before drop-down ul. in wordpress
- Unable to get Navigation Menu to display in the desired location
- WordPress theme editor not showing
- Add href to tag in nav menu for mobile
- How to change navwalker’s dropdown mark-up?
- How to switch menu location in this header.php?
- Bootstrap navbar responsiveness on WordPress theme menu not working
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Creating custom vertical menu
- Enable identical menu on network sites
- Custom location for menu
- No indication of menu
- Adding a menu item to the main menu
- wp_is_mobile() inside js
- Adding two same css class on menu item
- How to select single category in menu if post have two categories?
- menu is only pulling in one item
- Any reason why widgets/menus get emptied when I updated custom theme code?
- Add items to a menu
- How to get current menu item “CSS Classes” value?
- How to change page location in WordPress
- Use menu structure for permalinks
- Set menu item class into body
- how to keep theme background image, menu or site header image while moving site in sub directory?
- List WordPress Custom Menu’s active parent level’s children as separate menu
- Unable to edit Navigation bar
- Editor user only allow to post on certain categories
- Menu Underline shows without Hover after adding subitems
- Add class to current category menu item
- How to create a custom WordPress navigation menu?
- Should I custom code drop down menus or use a wordpress plugin?
- How to load css file in my menu in wordpress
- Navigation menu, remove item from desktop
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- Wrapping my ‘s with
- how to add permalink/slug to wordpress custom link menu item
- Using walker to display all menu branches at once?
- How to add a class directly on a unordered list element that is a primary navigation
- Icon not shown in Dropdown menus in Twenty Seventeen Theme
- How to change WP menu item type?
- add_submenu_page add multilevel menu
- Menu drop down covers contents of page in Mobile view
- conditional menu with custom fields
- Confused over difference between post and menu hierarchy
