WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#48681 closed enhancement (fixed)

WP_Taxonomy labels wrong initial type and documentation

Reported by: alpipego Owned by: 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 8 months ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
8 months 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
8 months 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
8 months ago

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

Note: See TracTickets for help on using tickets.