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
- How to avoid wp_nav_menu() ID conflict?
- Remove unusable metaboxes in nav menu management screen
- Highlight parent menu item when child is not in menu
- Output the aria-labelledby parameter for a nav menu child
- Hide menu items for visitors and filter based on role
- Appearance -> Menu -> Menu Structure : Add plain HTML code as an element
- show different admin menu to different user roles
- Reuse a custom WordPress menu on another WordPress website
- Default WordPress menu content
- how do i change the text under a navigation menu [closed]
- How do you add a around the second level of a Menu?
- Remove admin menu
- Creating menu and breadcrumb “sections” within WordPress 3 being used as a CMS
- Unable to get menu pattern using a walker
- Menu not adding the right items
- Theme for subcategories
- Walker_Nav_Menu creating too many closing tags?
- Custom menu including also primary menu items
- open menu link (PDF) in new tab not download
- twentysixteen child theme – responsive menu – ham icon button not working – Cannot read property ‘classList’ of null
- How to add Loginout to Sub-menu
- How to extend WP_query to a specific table?
- PHP Warning adding menu
- Menu selection for header
- Customize version different to Live version
- Editing/Removing Secondary Menu from Divi
- Making wordpress menu horizontal [closed]
- Hardcoding links to wp_nav_menu
- wp_nav_menu() reutrns HTTPS?
- load wp_menu dynamically with enquire.js
- How to make a page to not appear in the menu when created?
- Display Username as parent menu item
- My html data comes after the nav menu renders?
- How to modify menu text in callback function of ‘walker_nav_menu_start_el’ hook
- How to let the role “editor” to control the menu?
- Menu in widget with yahoo style
- The menu item is not deleted on WordPress