WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 3 months ago

#25397 new defect (bug)

In admin menu, current menu item applied to parent CPT when adding a new post for a CPT that is under it.

Reported by: ericlewis Owned by:
Milestone: Awaiting Review 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)

Screen Shot 2013-09-23 at 11.45.58 AM.png (74.6 KB) - added by ericlewis 7 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 ericlewis7 months ago

In the attachment, an example of the issue. I'm adding a new "Page Section," while "All Pages" is highlighted in the menu.

comment:2 ericlewis7 months 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' );

comment:3 helen7 months ago

Related: #19125

comment:4 nacin3 months ago

  • Component changed from General to Post Types
Note: See TracTickets for help on using tickets.