Here are a couple things I noticed.
You don’t want to include the <a> inside of link_before or link_after, you will get 2 links if you do that. You also don’t need the <ul>. Instead I think you want something like this…
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'before' => '<class="nav-item active">',
'menu_class' =>'navbar-nav mr-auto',
'link_before' =>'<span class="nav-link">',
'link_after' =>'</span>',
'container' => false,
'items_wrap' => '%3$s'
));
?>
You should read more about wp_nav_menu.
Related Posts:
- How to add or remove borders in navigation menu?
- Adding an Arbitrary Link to the Admin Menu?
- Split up wp_nav_menu with custom walker
- How to Add to Each Menu Link with link text to data-attr?
- Add custom classes to anchor in wp_nav_menu
- Removing link ” from ” menu for some “links” without JS
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- How to move parent li to end of child ul
- Show menu item description with line breaks
- Remove/Disable “Automatically add new top-level pages to this menu”
- Bar separated navigation by extending Walker_Page
- Custom Nav Walker sub-menu HTML construct
- Add class to menu ul with active child
- Make compatible custom menu widget for Twitter Bootstrap
- Does WordPress create mobile menus automatically?
- How to display dynamic content in start_lvl function
- Add custom text to menu
- Menu styling for last menu item
- Disable automatig SVG tag from menu
- Menus like a CMS
- Replace menu permalink/hyperlink with only menu name/slug
- wp_nav_menu add some element to container
- Third level navigation class
- get_query_var(‘post_type’) not returning in a filter
- Find out if a page has no parent
- Prev / Next menu item
- wp_nav_menu() with multiple Class
- add span class and i tag inside wp_nav_menu link anchor tag
- Can’t include Language switch in Nav Menu
- Add within the output of
- Grey out nav buttons unless is_user_logged_in()
- How to approach this menu design?
- Trying to Create Menu in WordPress
- Reuse a custom WordPress menu on another WordPress website
- How to dynamically populate a dropdown
- Is this format possible with a custom Nav Walker class?
- two different separate sections on the same site
- Cant add menu items with my theme
- How do you add a around the second level of a Menu?
- How should I build a custom menu walker for this setup?
- Help with walker for nav
- Hide menu from homepage
- Adding toggle-able element after menu item
- Full screen nav menu block with avada theme
- How to hide the menu item created by the theme in WordPress admin panel?
- Add custom link on the fly to nav menu
- 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
- How to add columns to wordpress menu editor
- how to insert data in li tag of navigation
- Current author archive in navigation menu
- Mobile navigation is shown, but standard navigation does not disappear
- changing the labels inside appearance -> menus for some for the fields
- How to create menu spread over four lines including images
- How to show submenu of any page in main menu
- WP Menu Rollover Nav Item and Effect DIV Elsewhere
- Help with WordPress Custom Nav Walker
- How to change the navigation menu
- Add/remove image from navigation bar
- WordPress nav_menu items from another menu appearing
- Does the Default theme of WordPress like 2016, 2017 and 2019 uses Walker_Nav_Menu Class
- How can I order these pages in this navigation bar on this old wordpress theme?
- Bootstrap Nav Walker Sub Menu Image
- Where to place a svg chevron down in my custom walker?
- How to apply individual menu item’s “CSS Classes” to , not ?
- Add active class to wp_nav_menu
- Output existing wp_nav_menu with a custom walker
- how to split vertical menu into two columns using walker nav menu
- Sub-Items Not Visible in Navigation
- How can I create this menu with wp_nav_menu()?
- Header lists posts instead of showing primary nav menu
- Menu Details Output in Javascript [closed]
- Show Child of Parent Page including all other parents
- Can’t add optional class to menu item when using Walker_Nav_Menu
- Making wordpress menu horizontal [closed]
- nav_menu: how to force a subpage switching on the parent menu
- wp_dropdown_nav function to list menu items
- wp_nav_menu() reutrns HTTPS?
- Show only second level menu items? [duplicate]
- Add item ONLY to the primairy navigation
- wp_nav_menu in 3.7 add name class nav navbar-nav
- Update nav menu item position programmatically
- Navigational error
- Determine if a navigation item has children
- Image menu on responsive WordPress
- individual images as navigation design TwentyTen
- Display Username as parent menu item
- The menu jumps a few pixels after the website loads
- How do I programatically remove Menus?
- Displaying a Custom Avatar in WP Bootstrap Navwalker Menus in WordPress
- Is there a way to make it so that I don’t get a hamburger menu, but rather a desktop style nav, when resizing to a mobile size
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- Give custom class names to WP nav sub-menu
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Header not showing in new pages
- Add a new menu selector element into WordPress nav-menus.php
- How to get and set post meta for core/navigation-link?
- How to add toggle-able DOM element after nav menu item?