WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 2 weeks ago

#48558 reviewing enhancement

Return the taxonomy object in register_taxonomy()

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

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 2 weeks ago.

Download all attachments as: .zip

Change History (3)

@krynes
2 weeks ago

#1 @krynes
2 weeks ago

  • Keywords has-patch added

#2 @SergeyBiryukov
2 weeks ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.