Make WordPress Core

Opened 13 years ago

Last modified 4 years ago

#16828 new enhancement

Add filter on initial_meta_boxes for nav menu

Reported by: aaroncampbell's profile aaroncampbell Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch has-screenshots dev-feedback
Focuses: ui 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 (3)

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

Download all attachments as: .zip

Change History (22)

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

proposed fix

#2 @SergeyBiryukov
11 years ago

#24256 was marked as a duplicate.

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

Patch with more specific hook name

#4 @Chouby
11 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
9 years ago

+1 for this filter. Very useful for multisite installations

#6 @moreauf
9 years ago

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

#7 @barryceelen
6 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 6 years ago by barryceelen (previous) (diff)

#8 @barryceelen
6 years ago

  • Focuses ui added

@barryceelen
6 years ago

Boldly deprecate wp_initial_nav_menu_meta_boxes()

#9 @barryceelen
6 years ago

#41820 was marked as a duplicate.

#10 @felipeelia
6 years 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.


6 years ago

#12 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 5.0

#13 @pento
5 years ago

  • Milestone changed from 5.0 to 5.1

#14 @pento
5 years ago

  • Milestone changed from 5.1 to Future Release

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


4 years ago

#16 @karmatosed
4 years 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 years 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

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


4 years ago

#19 @michaelarestad
4 years ago

  • Keywords dev-feedback added; ui-feedback removed
Note: See TracTickets for help on using tickets.