Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]

With .= you are appending you HTML code to the HTML code of the menu contained in the string $items, so the login will appear at the end.

You instead want to insert the link inside the HTML of $items, so you must manipulate the string.

You for example can search for the HMTL of the link the should appear before yours with str_replace()

I suggest you to var_dump $items and see the HTML than manipulate it with str_replace()

Related Posts:

  1. automatically adding submenu items
  2. Logout hyperlink within a sub-menu
  3. Custom Nav Walker sub-menu
  4. retrieves menu and converts it to a readable array
  5. Secondary Menu and Logged In Users
  6. why is this function firing on all child menu items as well?
  7. How to hightlight all ancestor menu items of a child page NOT displayed in menu
  8. Unable to add extra elements to the main navi (wp_nav_menu_items)
  9. Add Login and logout buttons to top menu bar
  10. Conditional custom menu?
  11. Insert menu into theme location depending on user logged in/out status
  12. Modify sub_menu function to show pages below a specifically set page
  13. How do I get my nav menu to show sub pages?
  14. Registration Hooks don’t appear to be working
  15. Removing specific menu items?
  16. Redirect to another page using contact form 7? [closed]
  17. help I changed one currency in woocommerce and everything is ruined [closed]
  18. Functions when woocommerce isn’t installed
  19. How to override woocommerce.css?
  20. How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
  21. How to change this simple code so that it sends the email notification after payment in WooCommerce?
  22. (Woocommerce) Order by price when entering specific category
  23. How do I hook into the container of wp_nav_menu?
  24. If user is logged-in display/hide something
  25. New custom menu created. how to apply it?
  26. Dropline menus — seperators between children only?
  27. Filter nav menu items HTML tags and wrap inner text with span
  28. Create custom function for hero image
  29. Functions php shortcode for displaying main menu with no child items
  30. Nav menus all outputting the same links
  31. Change menu based on page template via functions.php
  32. replace text in Sort Box
  33. Show some menu sub items as dropdown under a menu item
  34. add_filter to specific WooCommerce Category
  35. Woocommerce checkout field
  36. Woocommerce image sizes missing from Appearance › Customize but not declared by theme
  37. Prevent WordPress Automatic Logout
  38. add referrer to woo
  39. How to add custom li item to wordpress menu
  40. error at login page in wordpress
  41. Way to redirect all Product Sub Category to its Main category Page?
  42. Logout Redirect and also WP-login.php Redirect
  43. Create a Woocommerce product widget with category filter
  44. Delay a function, any function!
  45. Default Nav Highlight
  46. Auto scroll to id on page load on all pages except home page. Only do this on mobile
  47. Different methods of adding menu support to custom theme
  48. Adding a section in line at the end of the main navigation menu in php
  49. How add body_class from wp_termmeta
  50. Multiple navigation menu in same location
  51. Adding product to WooCommerce cart [closed]
  52. Change WooCommerce add_to_cart Button Text?
  53. wp_nav_menu work in functions.php but not in the theme
  54. How to register a menu based on a ACF condition
  55. WooCommerce -> wc_enqueue_js not working [closed]
  56. Use existing image sizes for WooCommerce
  57. current_page_item is missing inside wp_nav_menu
  58. search form leads to 404
  59. loginout function customization
  60. Show login greeting above sub-menu links?
  61. Remove submenu item from list
  62. How Can I add a menu to the theme from withen the function.php file
  63. define css class in functions.php
  64. Custom Menu in Admin doesn’t change menu in browser
  65. Show errormessages on wrong username/password on custom loginform?
  66. How would I make a function to dynamically determine if user is logged to change navigation menu text?
  67. WordPress login set cookie that survive browser exit (wp_signon function)
  68. wp_nav_menu displaying all pages
  69. Woocommerce Variable Product Dropdown for Custom Shop Template
  70. Warning at top of website & top menu gone
  71. How to hide content on mobile in the functions.php file – woocommerce
  72. Woocommerce Default sorting product by product type
  73. This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
  74. How to hide WooCommerce product title and short description to non logged in users?
  75. Prevent wp_signon redirect on failed login for ajax login
  76. How to redirect Subscribers on login to specific page, when logging in from a Page
  77. How to display an image before title text in menu items
  78. How to add custom metakey to shop_order page’s searching function?
  79. localize_script but data changes dependent on product ID
  80. Changing the HTML of notices in WooCommerce [closed]
  81. How to replace ACTION url from original wordpress login form?
  82. Change class woocommerce on function.php
  83. Bizarre Child Menu Issue on WP Site
  84. Show ‘Add to Cart’ on Out of Stock products
  85. Header menu aligned right on all pages except for single-post page [closed]
  86. Hide ‘add to cart’ when certain value in dropdown is selected
  87. removing description tabs – single product page – breaks footer
  88. Link product attribute value to a URL – woocommerce
  89. Remove text after a dot and a colon in Woocommerce product title
  90. When are the user meta fields created in the database? Admin vs Woo API REST
  91. price of product can’t return when get data of product in functions.php
  92. Unable to login after registration
  93. Woocommerce product price change
  94. Help with with my function for wordpress
  95. How to add all subcategories as submenu in WordPress menu
  96. Menu not updating for logged in users after redirect
  97. Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
  98. is_product_category(‘Services’) not working
  99. Allow logged in user to view a Page, else send to login screen and then redirect back to Page
  100. How to automatically add counted number to navigation menu items?
Categories functions Tags functions, login, menus, sub-menu, woocommerce-offtopic
Add new post in existing categories using wp_insert_post
Modify available templates (in dropdown)

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress