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:
- automatically adding submenu items
- Logout hyperlink within a sub-menu
- Custom Nav Walker sub-menu
- retrieves menu and converts it to a readable array
- Secondary Menu and Logged In Users
- why is this function firing on all child menu items as well?
- How to hightlight all ancestor menu items of a child page NOT displayed in menu
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Add Login and logout buttons to top menu bar
- Conditional custom menu?
- Insert menu into theme location depending on user logged in/out status
- Modify sub_menu function to show pages below a specifically set page
- How do I get my nav menu to show sub pages?
- How to create a custom order status in woocommerce!
- Get menu object from theme_location
- How to show product SKU on product page
- Remove Container Element From wp_nav_menu() Markup
- How to get woocommerce inventory status [closed]
- Woocommerce add to simple product attribute programmatically [closed]
- How can I tell if I’m on a login page? [duplicate]
- In WooCommerce I need to modify the thankyou.php page [closed]
- Breadcrumbs showing Parent and Child Pages
- How to activate “Description” metabox for menu item programmatically?
- Dynamically add sub-categories to any category in the menu
- Two different menus for two different locations?
- Remove product description from product archive page
- Logging in redirects to correct page but shows logged out content until forced refresh
- display 100 products per page on product category page [closed]
- Unregister Nav Menu with fallback?
- How to programmatically set a menu to be the Primary Menu?
- Adding WooCommerce to a Custom Theme – not working [closed]
- Can you use admin pages functionality on the frontend of your site
- Remove default user registration, login and subscriber profiles
- Override woocommerce wc-class function
- Add Product categories to WordPress menu without losing hierarchy
- Display WooCommerce subscriptions for user [closed]
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Make menu structure match page heirarchy on page parent change
- Is there a way to add a class to non current menu item?
- Woocommerce checkout field maxlength, make input number field only (postcode)
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Members only site – still need the lost password page accessible
- How To Remove Duplicate Menu Locations
- Set quantity of woocommerce product on page visit [closed]
- Where do I add html code to the menu div?
- How do I create page navigation linking to each H2 within the page? [closed]
- How to add nav menu items to a specific position within a menu
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- How to display custom option field in woocommerce orders in admin panel?
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- Hide product categories and taxonomy terms in menu if empty
- How to auto refresh when user change postcode
- Replace a menu with widget or a custom template file programmatically
- Categories as main menu items and subcategories as nested lists
- woocommerce change currency per category [closed]
- Get User Login Data (date, time… )
- How to override woocommerce.css?
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- How to change this simple code so that it sends the email notification after payment in WooCommerce?
- New custom menu created. how to apply it?
- Woocommerce checkout field
- add referrer to woo
- Logout Redirect and also WP-login.php Redirect
- Create a Woocommerce product widget with category filter
- Default Nav Highlight
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- Multiple navigation menu in same location
- Change WooCommerce add_to_cart Button Text?
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- current_page_item is missing inside wp_nav_menu
- Remove submenu item from list
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Woocommerce Default sorting product by product type
- Change class woocommerce on function.php
- Bizarre Child Menu Issue on WP Site
- Header menu aligned right on all pages except for single-post page [closed]
- When are the user meta fields created in the database? Admin vs Woo API REST
- price of product can’t return when get data of product in functions.php
- Woocommerce product price change
- is_product_category(‘Services’) not working
- How to automatically add counted number to navigation menu items?
- Menu and category highlighting for a single post
- WordPress Toggle Menu has stopped working
- Woocommerce – Switching Price for Category
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Move product attributes after summary on single product page
- How to add widget in main menu
- function syntax is off,
- Redirect after login to current URL
- Language Switch Function
- WordPress permanently logging users out
- wp_nav_walker that interacts with widgets to setup mega menu
- How to add a class name to the ancestor of a post?
- is_user_logged_in() isn’t working
- update_user_option not working as expected
- Get term count on a category page
- add variable to actions/functions across different files (woocommerce)
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?