Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#21104 closed defect (bug) (fixed)

Taxonomies on attachments should not generate UI is show_ui is false

Reported by: simonwheatley Owned by: markjaquith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords: has-patch commit
Focuses: Cc:


Currently if you register a taxonomy and associate it with attachments, the show_ui argument does not affect whether WordPress generates the UI for the taxonomy in the media item edit form. If show_ui is false, then no UI should be generated anywhere in any admin screen.

$args = array(
	'label'   => 'Test Taxonomy',
	'show_ui' => false,
register_taxonomy( 'test', array( 'attachment' ), $args );

Attachments (1)

21104-sw-1.diff (465 bytes) - added by simonwheatley 3 years ago.
Patch to prevent taxonomy fields showing on media item edit form if show_ui is false

Download all attachments as: .zip

Change History (7)

@simonwheatley3 years ago

Patch to prevent taxonomy fields showing on media item edit form if show_ui is false

comment:1 @simonwheatley3 years ago

Fix seems pretty simple, just check for show_ui in get_attachment_fields_to_edit at the same point as we check for the public argument. See patch above.

comment:2 @SergeyBiryukov3 years ago

  • Milestone changed from Awaiting Review to 3.5

comment:3 @nacin3 years ago

  • Keywords commit added; dev-feedback removed

Before doing this, I just wanted to confirm that show_ui is true by default for register_taxonomy(). That is the case, so I am good with this.

comment:4 @husobj3 years ago

  • Cc ben@… added

comment:5 @markjaquith3 years ago

show_ui is null by default, and falls through to the value of public, which is true by default.

comment:6 @markjaquith3 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In [21240]:

Hide UI for Attachment taxonomies if show_ui is false for that taxonomy. props simonwheatley. fixes #21104

Note: See TracTickets for help on using tickets.