Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#48558 closed enhancement (fixed)

Return the taxonomy object in register_taxonomy()

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Priority: normal Milestone: 5.4
Component: Taxonomy Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Background:

  • register_post_type() returns the registered post type object on success, a WP_Error object on error.
  • register_taxonomy() returns nothing on success, a WP_Error object on error.

From a consistency point of view, I think it would make sense for register_taxonomy() to return the registered taxonomy object as well.

Some history, for context:

  • [5525] introduced register_taxonomy().
  • [11998] introduced register_post_type().
  • [12597] introduced a return value for register_post_type(), the $args array at the time.
  • [37890] introduced WP_Post_Type object, and changed register_post_type() return value to that.
  • [38747] introduced WP_Taxonomy object, but not as a register_taxonomy() return value, as it never had one.

Attachments (1)

48558.diff (1016 bytes ) - added by krynes 7 years ago.

Download all attachments as: .zip

Change History (5)

@krynes
7 years ago

#1 @krynes
7 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review5.4
  • Owner set to SergeyBiryukov
  • Status newreviewing

#3 @SergeyBiryukov
7 years ago

  • Resolutionfixed
  • Status reviewingclosed

In 47186:

Taxonomy: In register_taxonomy(), return the registered taxonomy object on success, for consistency with register_post_type().

Props krynes, SergeyBiryukov.
Fixes #48558.

#4 @SergeyBiryukov
7 years ago

In 47187:

Docs: Add a @since note for [47186].

See #48558.

Note: See TracTickets for help on using tickets.