Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#19384 closed defect (bug) (duplicate)

register_taxonomy() doesn't fail (silently or otherwise) when trying to use a reserved term

Reported by: iamfriendly's profile iamfriendly Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Taxonomy Keywords:
Focuses: Cc:

Description

Title says it all really, but here's how I found out:

Registered a custom taxonomy called "type" and associated it with a custom post type called 'portfolio'. Worked fine, admin menu appeared, meta box was added to Portfolio CPT screens, everything worked as expected.

Until... I tried to add an image, and then pressed the 'Media Library' tab in the overlay. Even though I had 72 images in my media library, it didn't show any at all. (Not a show-stopper, but pretty annoying). Tracked it down, eventually to the fact that 'type' is a reserved term.

It looks like register_taxonomy() doesn't utilise taxonomy_exists(). I suspect this is because the latter function has only been around since 3.0 whereas the former has been with us since 2.3.

Suggestion: Throw an error if someone tries to overwrite a pre-existing taxonomy.

Change History (4)

#1 @nacin
14 years ago

'type' isn't an existing taxonomy, it's just a pseudo-reserved term due to the media library.

IIRC, the conflict stems from a type query variable, rather than the taxonomy as a whole.

I would rather adjust the media library, or temporarily force the unregistering of a type (and tab, I believe) query variable when loading up the iframe.

N.B. taxonomy_exists() was renamed from is_taxonomy() in 3.0. The original function was introduced in 2.3.

#2 @iamfriendly
14 years ago

That's understood, Nacin. Thanks for replying.

I personally expected some sort of failure, however. Perhaps just me being a pedant :)

#4 @nacin
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.