In my theme I have menu for max 2 levels. Now I want prevent to create more than 2 levels menu in admin dashboard. Is there any way to do that?
I investigated the codebase a bit and found a
globalMaxDepth option in
wpNavMenu.options.globalMaxDepth = 1 from the browser console in
/wp-admin/nav-menus.php you are no longer able to nest more than one level per drag and drop.
To achieve your goal you can now use
admin_enqueue_scripts to add a JS file to your backend which calls this code.
Hope this helps!