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?
- Registration Hooks don’t appear to be working
- Removing specific menu items?
- Redirect to another page using contact form 7? [closed]
- help I changed one currency in woocommerce and everything is ruined [closed]
- Functions when woocommerce isn’t installed
- 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?
- (Woocommerce) Order by price when entering specific category
- How do I hook into the container of wp_nav_menu?
- If user is logged-in display/hide something
- New custom menu created. how to apply it?
- Dropline menus — seperators between children only?
- Filter nav menu items HTML tags and wrap inner text with span
- Create custom function for hero image
- Functions php shortcode for displaying main menu with no child items
- Nav menus all outputting the same links
- Change menu based on page template via functions.php
- replace text in Sort Box
- Show some menu sub items as dropdown under a menu item
- add_filter to specific WooCommerce Category
- Woocommerce checkout field
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- Prevent WordPress Automatic Logout
- add referrer to woo
- How to add custom li item to wordpress menu
- error at login page in wordpress
- Way to redirect all Product Sub Category to its Main category Page?
- Logout Redirect and also WP-login.php Redirect
- Create a Woocommerce product widget with category filter
- Delay a function, any function!
- Default Nav Highlight
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- Different methods of adding menu support to custom theme
- Adding a section in line at the end of the main navigation menu in php
- How add body_class from wp_termmeta
- Multiple navigation menu in same location
- Adding product to WooCommerce cart [closed]
- Change WooCommerce add_to_cart Button Text?
- wp_nav_menu work in functions.php but not in the theme
- How to register a menu based on a ACF condition
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- current_page_item is missing inside wp_nav_menu
- search form leads to 404
- loginout function customization
- Show login greeting above sub-menu links?
- Remove submenu item from list
- How Can I add a menu to the theme from withen the function.php file
- define css class in functions.php
- Custom Menu in Admin doesn’t change menu in browser
- Show errormessages on wrong username/password on custom loginform?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- WordPress login set cookie that survive browser exit (wp_signon function)
- wp_nav_menu displaying all pages
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Warning at top of website & top menu gone
- How to hide content on mobile in the functions.php file – woocommerce
- Woocommerce Default sorting product by product type
- 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
- How to hide WooCommerce product title and short description to non logged in users?
- Prevent wp_signon redirect on failed login for ajax login
- How to redirect Subscribers on login to specific page, when logging in from a Page
- How to display an image before title text in menu items
- How to add custom metakey to shop_order page’s searching function?
- localize_script but data changes dependent on product ID
- Changing the HTML of notices in WooCommerce [closed]
- How to replace ACTION url from original wordpress login form?
- Change class woocommerce on function.php
- Bizarre Child Menu Issue on WP Site
- Show ‘Add to Cart’ on Out of Stock products
- Header menu aligned right on all pages except for single-post page [closed]
- Hide ‘add to cart’ when certain value in dropdown is selected
- removing description tabs – single product page – breaks footer
- Link product attribute value to a URL – woocommerce
- Remove text after a dot and a colon in Woocommerce product title
- 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
- Unable to login after registration
- Woocommerce product price change
- Help with with my function for wordpress
- How to add all subcategories as submenu in WordPress menu
- Menu not updating for logged in users after redirect
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- is_product_category(‘Services’) not working
- Allow logged in user to view a Page, else send to login screen and then redirect back to Page
- How to automatically add counted number to navigation menu items?