I found that WordPress added an extra space.
<ul class="sub-menu">
so the search and replace could not be done correctly. If you look in the code inspector (developer tools) you won’t see the extra space. Once going to view source code (command + shift + U), I noticed the actual output code had the extra space. Hope this will help someone with similar problem.
Related Posts:
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- wp_nav_menu remove class and id from li
- Custom search filter causes menu and query_posts problems
- Add separator to admin submenu
- On which hook should I be calling register_nav_menu(s)?
- Menu is not visible in appearance
- wp_nav_menu() not working on Custom Search Page
- One site, 2 distinct sections: two different top nav menus?
- Make Theme automatically choose default nav menu
- How can I disable parent menu item links?
- Organizing by super-categories (or nested categories)?
- Nav menu items disappearing (but not immediately)
- wp_nav_menu custom walker – child items
- wp_nav_menu doesn’t generate parent/ancestor classes
- Add static item to wp_nav_menu
- How to get wordpress nav menu outside of wordpress system?
- Add nav menu CSS class to body
- Where do custom menus get constructed?
- Change HTML structure for custom menu in sidebar
- Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?
- Custom Admin Menu Order
- Current menu item
- remove everything from wp_nav_menu
- How to add wechat (weixin) link to navigation menu?
- Create search form in menu as in Twenty Fourteen theme
- Admin only menu/page
- Best way to customise wp_nav_menu [duplicate]
- get_search_form() doesn’t appear to take parameter into account
- How to add custom classes to more than one separate menu’s a link in wordpress?
- How do I separate link levels in a custom menu walker?
- SlideDeck 2, make back-end visible for admins only
- Custom Links menu items include in Search Results
- pull non-wp site into content area of wordpress -or- pull wp header into non wp site?
- Help with walker for nav
- Create custom page and add it in nav menu by code
- Using my WordPress menu on another platform
- Remove a menu sub-item
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- Using _s theme, menu changes do not affect header menu
- Limit User Iinterface for Admin?
- Make pages visible to only logged in members
- Get custom classes in WordPress Navigation Menu
- Replace the slug of parent pages with # [closed]
- How to add search to menu?
- How to undo the last changes to a custom menu?
- Filter to hook into menu items and add a custom attribute
- I can’t add more pages to menu – menu delete pages
- Responsive menu on genesis theme [closed]
- Search form as list item in menu?
- How to open a lightbox form from a navigation menu item
- How to create this kind of sub-menu in new line?
- Hide custom menu when when no menu selected
- Admin: WooCommerce Navigation Menus do not show empty categories search tab
- Add a data attribute to list item element in menu
- how to display wordpress navbar with top menu outside wordpress system
- Creating and populating custom nav menu (menu-item-position not working)
- custom rearranged menu with excerpt for selected children in sidebar.php
- wp_nav_menu in 3.7 add name class nav navbar-nav
- Menu – custom structure
- custom walker to add iconfont to wp_nav_menu
- How To Add Class To Style Search Box
- Hiding Widget On Mobile Devices Removes Our Product Search Box On Mobiles
- Display a portion/ branch of the menu tree using wp_nav_menu()
- How to create a custom search for custom post type?
- Programmatically add a Navigation menu and menu items
- Any docs for wp_nav_menu’s “items_wrap” argument?
- Changing the Order of Admin Menu Sections?
- How make top level menu item not have link, but have sub-menus that are linked?
- Add ‘has_children’ class to parent li when modifying Walker_Nav_Menu
- Get WP Navigation Menu from REST API V2
- How to Hard Code Custom menu items
- Remove wrapping div and ul from output of wp_nav_menu
- How to add a Custom Link to a Menu with a URL that is relative to the blog URL
- How do I remove UL on wp_nav_menu?
- Retrieving a list of menu items in an array
- WordPress default menu in database
- Adding an Arbitrary Link to the Admin Menu?
- Dynamically exclude menu items from wp_nav_menu
- Add “Logout” link to navigation menu
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- Split up wp_nav_menu with custom walker
- Removing container from wp_nav_menu not working
- Custom Nav walker display current menu item children, or siblings on no children
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- Is there an easy way to replace a custom menu link with a page or post?
- Convert output of nav_menu items into a tree-like multidimensional array
- Get page IDs from nav items
- Add a custom walker to a menu created in a widget
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- wp_get_nav_menu_items() not working with slug
- How to get current-menu-item title as variable?
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Add Class to Specific Link in Custom Menu
- Remove a menu item in menu
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How do I get the name of a menu in WordPress?
- How to Add to Each Menu Link with link text to data-attr?
- How to manually specify the current active page with wp_nav_menu()