#25397 closed defect (bug) (duplicate)
In admin menu, current menu item applied to parent CPT when adding a new post for a CPT that is under it.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | |
| Focuses: | Cc: |
Description
If you register a custom post type, and set the 'show_in_menu' option while registering it to another post type, in the "Add New" screen for the custom post type, the original 'show_in_menu' post type is highlighted.
Attachments (1)
Change History (7)
#2
@
12 years ago
To reproduce:
/**
* Register the page section post type.
*
* Page section post types will be related to pages, and make up the content
* of a page.
*/
function register_page_section_post_type() {
register_post_type( 'page-section', array(
'labels' => array(
'name' => 'Page Sections',
'singular_name' => 'Page Section',
'add_new' => 'Add New',
'add_new_item' => 'Add New Page Section',
'edit_item' => 'Edit Page Section',
'new_item' => 'New Page Section',
'view_item' => 'View Page Section',
'search_items' => 'Search Page Sections',
'not_found' => 'No page sections found.',
'not_found_in_trash' => 'No page sections found in Trash.',
'all_items' => 'All Page Sections'
),
'public' => false,
'publicly_queryable' => false,
'capability_type' => 'page',
'show_ui' => true,
'show_in_menu' => 'edit.php?post_type=page',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => false,
'query_var' => false,
'supports' => array( 'title', 'editor', 'revisions' ),
) );
}
add_action( 'init', 'register_page_section_post_type' );
Note: See
TracTickets for help on using
tickets.
In the attachment, an example of the issue. I'm adding a new "Page Section," while "All Pages" is highlighted in the menu.