WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#33925 closed defect (bug) (fixed)

same SLUGS make problems in dashboard SCREEN OPTIONS

Reported by: selnomeria Owned by: helen
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.3
Component: Administration Keywords: needs-patch
Focuses: Cc:

Description

hi.
I register taxonomy (with name "laptop") and custom post-type, with the same name.

but in APPEARENCE>CUSTOM MENUS , in "SCREEN OPTIONS",only taxonomies checkoxes are shown... there should be checkboxes for CUSTOM POST TYPES too.

Attachments (3)

nav-menu.diff (607 bytes) - added by psoluch 4 years ago.
33925.diff (680 bytes) - added by DrewAPicture 4 years ago.
Post types
33925.2.diff (668 bytes) - added by swissspidy 4 years ago.

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Administration

I remember having some issues with a CPT and a taxonomy with the same name as well.

#2 @wonderboymusic
4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.4

@psoluch
4 years ago

#3 @psoluch
4 years ago

  • Keywords has-patch added; needs-patch removed

The problem is caused by an id conflict. The solution would be to add "taxonomy-" prefix for taxonomies in wp_nav_menu_taxonomy_meta_boxes(); in wp-admin/includes/nav-menu.php. I've tested it and it seems it doesn't cause any side effects.

#4 @obenland
4 years ago

Seems like a straight forward fix. We should be aware that it will initially show all taxonomy meta boxes again, since user settings will not apply to them anymore until they're updated.

#5 @wonderboymusic
4 years ago

  • Owner set to helen
  • Status changed from new to reviewing

@helen would like your input here, por favor

#6 @helen
4 years ago

Losing the user settings for hiding taxonomies is a little annoying. Seems like it would be better to affect post types, since those are more likely to be desired as menu items and so showing them again might be less fallout? Unsure. Thoughts welcome.

@DrewAPicture
4 years ago

Post types

#7 @DrewAPicture
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 35450:

Menus: Prevent display conflicts in the screen options for Menus when a post type and taxonomy share the same slug.

Prior to this change, both taxonomies and post types added meta boxes to the Menus UI (which in-turn registered screen options) using the same ID formula: add-{$id}. This caused a conflict between the two elements, resulting in the rendering of a screen option for only the taxonomy or post type but not both. Moving to a new meta box ID for post types, add-post-type-{$id}, removes that conflict.

Note: This change in meta box IDs for post types effectively resets current user settings for the visibility of post types in the Menus UI.

Fixes #33925.

@swissspidy
4 years ago

#8 @swissspidy
4 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Looks like this broke wp_initial_nav_menu_meta_boxes().

33925.2.diff fixes the $initial_meta_boxes array by replacing add-page and add-post with add-post-type-page and add-post-type-post, respectively.

#9 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 35502:

Menus: After [35450], use correct IDs in $initial_meta_boxes.

Props swissspidy.
Fixes #33925.

Note: See TracTickets for help on using tickets.