WordPress.org

Make WordPress Core

Opened 9 years ago

Last modified 4 weeks ago

#16828 new enhancement

Add filter on initial_meta_boxes for nav menu

Reported by: aaroncampbell Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch has-screenshots ui-feedback
Focuses: ui Cc:
PR Number:

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 (3)

nav-menu.php.diff.patch (645 bytes) - added by layotte 7 years ago.
proposed fix
nav-menu.diff (735 bytes) - added by louisremi 7 years ago.
Patch with more specific hook name
16828.diff (2.5 KB) - added by barryceelen 2 years ago.
Boldly deprecate wp_initial_nav_menu_meta_boxes()

Download all attachments as: .zip

Change History (20)

#1 @layotte
7 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
7 years ago

proposed fix

#2 @SergeyBiryukov
7 years ago

#24256 was marked as a duplicate.

#3 @louisremi
7 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
7 years ago

Patch with more specific hook name

#4 @Chouby
6 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
5 years ago

+1 for this filter. Very useful for multisite installations

#6 @moreauf
5 years ago

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

#7 @barryceelen
2 years ago

  • Keywords has-patch has-screenshots ui-feedback added

This threw me off for a bit after registering a custom post type.

IMHO this limitation should be deprecated/removed entirely.

The function was introduced in 3.0 with a new menu editor. The way the meta boxes were displayed at the time quickly lead to a very loooong page, even when there were only core menu items visible. Limiting the number of meta boxes shown made sense.

This is not the case any more. The collapsed accordion does not cause a long page like it used to (subjective, I know), even if the core Tags and Post Formats (?) are not filtered out.

It does however cause the need to document/support "How do I add menu items for custom post types registered by [insert plugin name]??".

Then:

https://cobbledco.de/wp-content/uploads/2017/09/super-long-menu-edit-wp30.png

Now:

http://cobbledco.de/wp-content/uploads/2017/09/super-short-menu-edit-wp48.png

Last edited 2 years ago by barryceelen (previous) (diff)

#8 @barryceelen
2 years ago

  • Focuses ui added

@barryceelen
2 years ago

Boldly deprecate wp_initial_nav_menu_meta_boxes()

#9 @barryceelen
2 years ago

#41820 was marked as a duplicate.

#10 @felipeelia
19 months ago

+1 for deprecating it. As @Chouby pointed:

some users don't have the idea to go in the screen options but go directly to the support forum...

This ticket was mentioned in Slack in #core by whitneyyadrich. View the logs.


15 months ago

#12 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.0

#13 @pento
14 months ago

  • Milestone changed from 5.0 to 5.1

#14 @pento
11 months ago

  • Milestone changed from 5.1 to Future Release

This ticket was mentioned in Slack in #design by karmatosed. View the logs.


4 weeks ago

#16 @karmatosed
4 weeks ago

This came up in design triage today and for the design team to know if this does indeed need our feedback, could we have some screenshots and more information please?

#17 @barryceelen
4 weeks ago

@karmatosed the initial premise for this ticket was to enable developers to filter which meta boxes are shown in the navigation menu admin page (by default only a core set are visible). I proposed to remove that functionality completely, and show all registered meta boxes because I think the original reason to hide them became moot with the current admin layout (See: https://core.trac.wordpress.org/ticket/16828#comment:7)

These screenshots illustrating the old and new situation are still available here:

Then:
https://cobbledco.de/wp-content/uploads/2017/09/super-long-menu-edit-wp30.png

Now:
http://cobbledco.de/wp-content/uploads/2017/09/super-short-menu-edit-wp48.png

Note: See TracTickets for help on using tickets.