Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#15982 closed defect (bug) (fixed)

Attachment taxonomies broken

Reported by: nacin's profile nacin Owned by:
Milestone: 3.1 Priority: normal
Severity: blocker Version:
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

This works in 3.0. It does not in RC1.

add_action( 'init', function() {
	// create a new taxonomy
	register_taxonomy(
		'people',
		array( 'attachment:image', 'attachment:video', 'attachment:audio' ),
		array(
			'label' => __('People'),
			'template' => __('People: %l.'),
			'helps' => __('Separate people with commas.'),
			'sort' => true,
			'args' => array('orderby' => 'term_order'),
			'rewrite' => array('slug' => 'person'),
		)
	);
}

Attachments (1)

15982.diff (553 bytes) - added by nacin 13 years ago.

Download all attachments as: .zip

Change History (7)

#1 @nacin
13 years ago

sanitize_key() is killing the colons. In 3.0, we took $object_type at face value. (An unstrict sanitize_user doesn't strip the colons, either.)

Suggest we simply revert [16822] for taxonomy.php. It was a good faith change, but we didn't previously sanitize there, and there's no real need either. The object type has to match a sanitized key anyway (usually), so it doesn't hurt to accept anything here.

@nacin
13 years ago

#2 @nacin
13 years ago

  • Keywords has-patch added

#3 @nacin
13 years ago

Originally reported over wp-hackers. http://lists.automattic.com/pipermail/wp-hackers/2010-December/036954.html

Reporter mentions one other issue, "The taxonomy listing page in the front end returns no results." Not sure what's going wrong there, and whether that's addressed by this patch, caused by a plugin, or if we need to account for something else perhaps in our taxonomy query logic.

#4 @nacin
13 years ago

  • Keywords commit added

Patch is good to go. Probably want to leave open for the final point in the initial report.

#5 @thee17
13 years ago

This fixed the problem I reported.

The final point had it's own ticket #14370 and is probably too complicated to me it into 3.1, and has a work around that only has a side effect that pagation does not work.

#6 @ryan
13 years ago

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

(In [17155]) Don't sanitize_key() the post type so that colons aren't stripped from attachment types. Props nacin. fixes #15982

Note: See TracTickets for help on using tickets.