Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#24256 closed enhancement (duplicate)

Custom Post Types are hidden by default in the nav-menu page and there's no clean way to prevent that

Reported by: louisremi's profile louisremi Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: has-patch
Focuses: Cc:


The function wp_initial_nav_menu_meta_boxes marks all non-built-in meta-boxes as hidden.

This has some unexpected consequences: register_post_type has an option show_in_nav_menus and one would guess that setting this to true would display a meta-box for this post type on the nav-menu UI, but it doesn't.

The real problem is that there is no clean way to prevent that behavior: the only hook available is hidden_meta_boxes and using it to un-hide meta-boxes also overrides screen-options actually selected by the user. (default_hidden_meta_boxes is never executed for nav-menus, because of wp_initial_nav_menu_meta_boxes).

I'm not sure why wp_initial_nav_menu_meta_boxes was written in the first place, but it should at least provide a hook to add additional $initial_meta_boxes.

Attachments (1)

nav-menu.diff (735 bytes) - added by louisremi 11 years ago.
Add a 'initial_nav_menu_meta_boxes' filter

Download all attachments as: .zip

Change History (8)

#1 @johnbillion
11 years ago

  • Cc johnbillion added

11 years ago

Add a 'initial_nav_menu_meta_boxes' filter

#2 @louisremi
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Type changed from defect (bug) to enhancement

#3 @johnbillion
11 years ago

I don't think your patch is the correct approach. If a custom post type or taxonomy specifies show_in_nav_menus as true then they should show up on the nav menu screen without needing to hook into a filter too.

#4 @toscho
11 years ago

  • Cc info@… added

#5 @louisremi
11 years ago

@johnbillion I agree with you but I was guessing wp_initial_nav_menu_meta_boxes was here for a reason. The alternative is to drop that function and its single function call in nav-menus.php altogether.

#6 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
  • Status changed from new to closed
  • Version changed from trunk to 3.0

Duplicate of #16828.

#7 @SergeyBiryukov
11 years ago

  • Resolution set to duplicate
Note: See TracTickets for help on using tickets.