Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#48681 closed enhancement (fixed)

WP_Taxonomy labels wrong initial type and documentation

Reported by: alpipego's profile alpipego Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version: 5.4
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

The initial value of WP_Taxonomy::$labels is an empty array but gets converted to a stdClass object. The docblock comment also states array even though the return correctly says object.

The patch updates the inline documentation and the initial type of $labels.

Attachments (1)

wp_taxonomy-labels.diff (857 bytes) - added by alpipego 5 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#2 @SergeyBiryukov
5 years ago

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

In 46743:

Taxonomy: Correct the initial value for WP_Taxonomy::$labels to match get_taxonomy_labels() return type.

Improve documentation for consistency with WP_Post_Type::$labels.

Props alpipego.
Fixes #48681.

#3 @SergeyBiryukov
5 years ago

For reference, the value is set in ::set_props(), which runs from ::__construct().

Note: See TracTickets for help on using tickets.