Use the fallback_cb
argument of wp_nav_menu()
:
(callable|bool) If the menu doesn’t exists, a callback function will fire. Default is ‘wp_page_menu’. Set to false for no fallback.
<?php
wp_nav_menu( array(
'theme_location' => 'main_menu_4',
'fallback_cb' => false
'depth' => 1,
) );
?>