WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#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: ericlewis 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)

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

Download all attachments as: .zip

Change History (7)

#1 @ericlewis
5 years ago

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

#2 @ericlewis
5 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' );

#3 @helen
5 years ago

Related: #19125

#4 @nacin
4 years ago

  • Component changed from General to Post Types

#5 @chriscct7
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

This works in 4.4. I can't find the ticket at the second but I think this is something @mordauk finished as part of WordCamp Orlando contributor day in 2013.

#6 @chriscct7
3 years ago

  • Resolution changed from worksforme to duplicate

Duplicate of #24137.

Note: See TracTickets for help on using tickets.