[wp-trac] [WordPress Trac] #24137: CPT as a submenu item does not get the correct classes when adding new

WordPress Trac noreply at wordpress.org
Sat May 11 00:32:28 UTC 2013


#24137: CPT as a submenu item does not get the correct classes when adding new
--------------------------+------------------------------
 Reporter:  mordauk       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Post Types    |     Version:  3.5.1
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------
Changes (by SergeyBiryukov):

 * component:  Menus => Post Types


Old description:

> 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 [http://core.trac.wordpress.org/ticket/19125 #19125]
> and [http://core.trac.wordpress.org/ticket/22022 #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)
>
> `download_page_edit?post_type=edd_volume_discount`
>
> but the one retrieved by `get_plugin_page_hookname( "post-
> new.php?post_type=$post_type", $post_type_object->show_in_menu )` is
>
> `download_page_post-new?post_type=edd_volume_discount`.
>
> It appears the `$_registered_pages` global doesn't include (at least for
> submenu CPTs) `post-new`, only `edit`.

New description:

 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)

 `download_page_edit?post_type=edd_volume_discount`

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

 `download_page_post-new?post_type=edd_volume_discount`.

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

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24137#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list