Maybe try filtering just the menu items you want when they get printed back on the front end. You can do that in functions.php
Here you can filter the HTML list content for navigation menus.
https://developer.wordpress.org/reference/hooks/wp_nav_menu_items/
After some talk, give this a try and then call your lo()
where you need it:
function lo() {
add_filter( 'wp_nav_menu_items', 'dynamic_label_change', 10, 2 );
function dynamic_label_change( $items,$args) {
if($args->theme_location == 'primary'){
$items = str_replace("Categories", "new_string", $items);
$items = str_replace("Latest Offers", "another_new_string", $items);
}
return $items;
}
}
Related Posts:
- Dynamically exclude menu items from wp_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- adding some custom html code to the wp_nav_menu function
- Renaming a WordPress Admin Menu
- How to Move the Author Metabox into the “Publish” metabox?
- How do you get the current-menu-item ID?
- How do I give class to the dropdown sub-menu in the wp_nav_menu?
- Add log in link to menu in Twenty Twelve
- Add Menu items description via Custom Walker for wp_nav_menu()?
- Wrap description and sub menu in a wrapper
- how to only add a top-level admin menu without it creating a sub-level-menu
- How to get the post name (slug) from the item ID when traversing the navbar?
- Why is ‘nav_menu_item_args’ filter’s $item argument empty?
- wp_nav_menu – page template name as item class
- how to get nav menu list through menu name in wordpress
- wp_nav_menu – show children of current menu item only?
- how to assign more permission to wordpress author
- Strange behavor of wp_nav_menu by not appearing [closed]
- Keep parent page active
- Subpages in Menu Editor not Nesting
- bootstrap-navwalker will not load
- Check if menu id = $specific_id – then insert specific
- Where would I find Custom menu attributes in the database?
- How to create a Menu based a username
- How to add php to custom link in the nav menu? [closed]
- Menu / div of year and months of blog posts?
- How to replace the page url for the page slug in a menu link?
- Remove current class from sub menu items
- How to insert link to the default post archive into a menu
- Getting menu items like get_pages
- Add css class to dropdown
- nav_menu not displaying custom menu
- WordPress Menu Prepends URL To My Anchors
- Automatically list top level menu item child pages
- Check if menu_item has children or has parent
- wp_nav_menu add class to child item with sub child
- How to remove menu installed in wp-admin by a theme? [closed]
- How to modify wp-includes without messing my wordpress installation?
- Container class not appearing on navigation menu
- pull non-wp site into content area of wordpress -or- pull wp header into non wp site?
- Use wp_logout_url() in menu creation page
- Active Menu Highlighter with Subpages?
- WordPress template – How to add class to li tag if submenu exist
- display menu as table layout
- Insert a div class inside wordpress menu
- Retrieve Menu name for nav_menu_item
- Wrapping link and .sub-menu with wp_nav_menu
- Bootstrap button menu on wordpress
- Want to add different text after each menu item
- How to create a menu item which is not a page
- Add extra menu to theme
- How to list only root pages?
- Page menu with one image link instead of page title?
- Is there a way to tell menu items to force non-SSL URLs?
- Search if menu item has child in wp_get_nav_menu_items hook
- Trouble hiding menu on single page
- How to customize navigation menu in theme which is converted from pure html theme
- enqueue script during add menu items means before save menu items
- WordPress classes removed when using custom walker
- Custom HTML output for registered navigation
- Show subpages of a category in a custom menu
- 2 item in a same menu pointing to 1 page
- Dropdown primary navigation menu not working
- Understanding with this WordPress code
- New wp menu menu styling
- How do I make it so a post only shows in its category archive but not the home page?
- Link after WordPress
- Im having trouble centering menu items in footer due to “flexbox”
- When created sub-directory, can we create a new navbar?
- Is it all right to put the whole tag into template_part file?
- Mobile menu displays submenus on top of parent. Need it to display right below on an own line
- Misleading behaviour on Menu & Theme location
- How to build a menu that change style over a section
- Highlight inner post menu current item
- Menu dropdown disapears behind slider
- Generate Submenu based on Parent Page using If Statement
- How i can get current menu id with multiple occurrence
- Links in new menu don’t work
- how to change single post link
- Any simple way to show 10 previous pages by id to current page in links as a menu
- Vertical Menu items shifting to same line when window size increased [closed]
- Pass $item->description to start_lvl
- Menu on responsive twentytwelve theme not working, strange url error
- Access CSS Classes specified in Menu options
- Query for menus in backend (BE)
- Next/previous a-like single navigation
- How to output the menue structured for tabbed navigation?
- Add more levels to menu
- How to create a menu super voice in WP?
- WordPress Navigation
- Showing Custom Menus in the sidebar
- How to set up suhosin.ini for unlimited menus
- Customizing Responsive Themes Menu [closed]
- How To Conditionally Change Menu In Same Theme Location
- How to centre menu items on horizontal nav bar? (e.g. make margins equal) [closed]
- Display sub menus as separate lists
- Add menu to CMS page
- Not even able to Log in [closed]
- 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