[wp-trac] [WordPress Trac] #28287: CPT with 'show_in_menu' => 'users.php' does not get highlighted when adding new

WordPress Trac noreply at wordpress.org
Sat May 17 06:05:54 UTC 2014


#28287: CPT with 'show_in_menu' => 'users.php' does not get highlighted when adding
new
-------------------------------+-----------------------------
 Reporter:  dontdream          |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  3.9.1
 Severity:  normal             |  Resolution:  duplicate
 Keywords:  has-patch          |     Focuses:  administration
-------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Awaiting Review =>


Old description:

> When registering a post type as a submenu of a top level menu, the
> submenu item does not get highlighted correctly when adding a new item to
> the post type.
>
> Code to reproduce:
>
> {{{
> add_action ('init', 'cptest');
> function cptest ()
> {
>         $args = array
>         (
>                 'labels' => array
>                 (
>                         'name' => 'FooBars',
>                         'singular_name' => 'FooBar',
>                 ),
>                 'public' => false,
>                 'show_ui' => true,
>                 'show_in_menu' => 'users.php',
>         );
>
>         register_post_type ('foobar', $args);
> }
>
> }}}
>
> 1. Click ''Users -> FooBars''
> 2. In the newly opened admin page, click ''Add New'' (add new FooBar)
> 3. The ''All Users'' submenu item gets highlighted, instead of
> ''FooBars''
>
> This is very similar to ticket ''24137'', and is fixed by patch
> ''24137.2.patch'' by ''markjaquith'', attached to that ticket and
> replicated as attachment to this ticket.

New description:

 When registering a post type as a submenu of a top level menu, the submenu
 item does not get highlighted correctly when adding a new item to the post
 type.

 Code to reproduce:

 {{{
 add_action ('init', 'cptest');
 function cptest ()
 {
         $args = array
         (
                 'labels' => array
                 (
                         'name' => 'FooBars',
                         'singular_name' => 'FooBar',
                 ),
                 'public' => false,
                 'show_ui' => true,
                 'show_in_menu' => 'users.php',
         );

         register_post_type ('foobar', $args);
 }

 }}}

 1. Click ''Users -> FooBars''
 2. In the newly opened admin page, click ''Add New'' (add new FooBar)
 3. The ''All Users'' submenu item gets highlighted, instead of ''FooBars''

 This is very similar to ticket #24137, and is fixed by patch
 ''24137.2.patch'' by ''markjaquith'', attached to that ticket and
 replicated as attachment to this ticket.

--

Comment:

 Duplicate of #24137.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28287#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list