Before upgrading to Wordpress 4.8, I could do a string search and replace on the wp_nav_menu()
. I had a few sites running 4.7.5 and code was working. Soon as upgrading code below did nothing.
<?php
$args = array(
'theme_location' => $nav_name,
'container' => 'nav',
'items_wrap' => '<ul>%3$s</ul>',
'container_class' => " ",
'echo' => false
);
$nav = wp_nav_menu( $args );
$nav = str_replace('<ul class="sub-menu">', '<div class="mobile-drop"><ul>', $nav);
$match = '</ul>'."\n".'</li>';
$nav = str_replace($match, '</ul></div></li>', $nav);
echo $nav;
?>
Now post 4.8, it doesn't replace the "sub-menu" with my class called "mobile-drop". When I look at the html I do see an outputted "sub-menu" with double quotes.