WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#18706 closed defect (bug) (fixed)

Erroneous admin menu highlighting for non-public post type taxonomies

Reported by: johnbillion Owned by:
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

To reproduce:

  1. Register a post type with 'public' set to false and 'show_ui' set to true.
  2. Register a taxonomy for this post type.
  3. Visit the taxonomy management screen for your taxonomy. The 'Posts' top level menu will be highlighted instead of your custom post type.

Changing the 'public' parameter of the post type to true fixes the problem, but obviously does not have the desired outcome.

Sample code:

function add_my_post_type() {

	$post_type_args = array(
		'public'  => false,
		'show_ui' => true,
		'labels'  => array(
			'name'          => 'Foos',
			'singular_name' => 'Foo'
		)
	);
	register_post_type( 'foo', $post_type_args );

	$taxo_args = array(
		'public'  => false,
		'show_ui' => true,
		'labels'  => array(
			'name'          => 'Foo Types',
			'singular_name' => 'Foo Type'
		)
	);
	register_taxonomy( 'foo_type', 'foo', $taxo_args );

}

add_action( 'init', 'add_my_post_type' );

I had a dig but I can't find where the problem is occurring.

Attachments (1)

18706.patch (586 bytes) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (6)

@SergeyBiryukov4 years ago

comment:1 follow-up: @SergeyBiryukov4 years ago

  • Keywords has-patch added

WP_Posts_List_Table uses show_ui rather than public when sanitizing $post_type, so we probably should use it in WP_Terms_List_Table as well.

comment:2 @SergeyBiryukov4 years ago

  • Milestone changed from Awaiting Review to 3.3

comment:3 in reply to: ↑ 1 @mitchoyoshitaka3 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

This change was already made in [19089] as part of #19080.

comment:4 @SergeyBiryukov3 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

comment:5 @SergeyBiryukov3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.