Make WordPress Core

Opened 5 years ago

Last modified 2 years ago

#24137 closed defect (bug)

CPT as a submenu item does not get the correct classes when adding new — at Version 3

Reported by: mordauk Owned by:
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.5.1
Component: Posts, Post Types Keywords: has-patch wcorl needs-testing
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

When registering a post type as a submenu of another post type, the submenu item does not get high lighted correctly when adding a new item to the post type (the one that is a sub menu).

The post.php and edit.php screens work fine for the submenu post type; it is only post-new.php does that doesn't highlight correctly.

This is similar to #19125 and #22022, but not quite the same.

I think I've tracked the issue down to get_plugin_page_hookname() and the $_registered_pages global.

The submenu post type key in $_registered_pages is (for example)


but the one retrieved by get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) is


It appears the $_registered_pages global doesn't include (at least for submenu CPTs) post-new, only edit.

Change History (4)

#1 @chriscct7
5 years ago

  • Cc chriscct7@… added

#2 @mordauk
5 years ago

  • Cc pippin@… added

#3 @SergeyBiryukov
5 years ago

  • Component changed from Menus to Post Types
  • Description modified (diff)

4 years ago

Note: See TracTickets for help on using tickets.