WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 2 years ago

#16828 new enhancement

Add filter on initial_meta_boxes for nav menu

Reported by: aaroncampbell Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Menus Keywords:
Focuses: Cc:

Description

When you create a custom post type with show_in_nav_menus = true the metabox in Appearance->Menus is hidden to all new users. This is especially annoying for multi-site setups. The issue is in wp_initial_nav_menu_meta_boxes() where it sets the initial meta boxes:

$initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );

I'd settle for a filter on that, but it seems like a more complete fix would be to add the filter with a default function hooked into it which would add post types with show_in_nav_menus = true to the list.

Attachments (2)

nav-menu.php.diff.patch (645 bytes) - added by layotte 4 years ago.
proposed fix
nav-menu.diff (735 bytes) - added by louisremi 4 years ago.
Patch with more specific hook name

Download all attachments as: .zip

Change History (8)

#1 @layotte
4 years ago

Working on a plugin now that is running into a similar issue. For first-time users of the nav-menu who have our custom nav menu activated, it will not appear on the nav menu screen (unless they select it). We should be able to set our nav menus as visible by default upon viewing the nav-menus.php page initially.

@layotte
4 years ago

proposed fix

#2 @SergeyBiryukov
4 years ago

#24256 was marked as a duplicate.

#3 @louisremi
4 years ago

My bug has just been closed as duplicate from this one.
I came up with a patch similar to the one proposed by layotte but with a more specific name for the hook (because this feature is really specific to nav menus).

@louisremi
4 years ago

Patch with more specific hook name

#4 @Chouby
4 years ago

  • Cc frederic.demarle@… added

+1 for this filter as some users don't have the idea to go in the screen options but go directly to the support forum...

#5 @lenasterg
3 years ago

+1 for this filter. Very useful for multisite installations

#6 @moreauf
2 years ago

Wouldn't it make sense for this screen to make use of the already existing default_hidden_meta_boxes filter?

Note: See TracTickets for help on using tickets.