When you visit wp-admin/nav-menus.php
and there is no menu you get a set of metaboxes you cannot use. The only thing they do is drawing attention away from the Create Menu dialog.
I want to hide those boxes until there is a menu.
How can I do that?
Post Views: 2
There are two important global variables in
wp-admin/nav-menus.php
:$nav_menus
is an array of all available menus, filled withwp_get_nav_menus()
.$wp_meta_boxes['nav-menus']
is an array of all available metaboxes for this screen.We can hook into
admin_head-nav-menus.php
, an action called after the first variable has been set up, and change the second variable:Download as plugin T5 Hide dead menu metaboxes from GitHub.
Additional Information:
After removing meta boxes the screen is looking a bit odd. We could change a bit initial hook and add some styles to make it looking better. So our hook could be:
Then the screen will look more natural: