How do I remove UL on wp_nav_menu?
The function wp_nav_menu takes an argument of fallback_cb which is the name of the function to run if the menu doesn’t exist. so change you code to something like this: function wp_nav_menu_no_ul() { $options = array( ‘echo’ => false, ‘container’ => false, ‘theme_location’ => ‘primary’, ‘fallback_cb’=> ‘fall_back_menu’ ); $menu = wp_nav_menu($options); echo preg_replace(array( ‘#^<ul[^>]*>#’, ‘#</ul>$#’ … Read more