Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#52142 closed defect (bug) (fixed)

Declare `sort` and `args` properties of WP_Taxonomy

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 5.7 Priority: normal
Severity: normal Version: 2.5
Component: Taxonomy Keywords: good-first-bug has-patch has-dev-note
Focuses: Cc:

Description

WP_Taxonomy supports two properties which are not declared on the class, sort and args. These are used in wp_set_object_terms() and wp_get_object_terms() to control the sort order of terms in the taxonomy.

These properties should be declared on the class with an initial value of null, added to the documentation for wp_register_taxonomy(), and added to the default args array in WP_Taxonomy::set_props().

These properties were introduced in [6851] and [7520].

Change History (15)

This ticket was mentioned in PR #959 on WordPress/wordpress-develop by gunnard.


2 years ago
#1

  • Keywords has-patch added; needs-patch removed

…le values

declared 'sort' and 'args' as null for WP_Taxonomy
Trac ticket: https://core.trac.wordpress.org/ticket/52142

#2 @gunnard
2 years ago

Hello!
This sounds pretty straight forward. This is my first contribution and I will fix/adjust whatever I need to in order to follow the correct procedure.

#3 @johnbillion
2 years ago

Thanks for the patch @gunnard ! All looks good. Would you mind adding entries to the documentation for the $args parameter of the wp_register_taxonomy() function too?

#4 @gunnard
2 years ago

@johnbillion sounds good! added documentation to the function.

#5 in reply to: ↑ description ; follow-up: @SergeyBiryukov
2 years ago

Replying to johnbillion:

These properties were introduced in [6851] and [7520].

Since sort and args were technically introduced in WordPress 2.5 and 2.6 respectively, per the linked changes, I wonder if the @since tags should reflect that, rather than showing them as introduced in WordPress 5.7.

Looks good to me otherwise :)

#6 in reply to: ↑ 5 @gunnard
2 years ago

Replying to SergeyBiryukov:

Replying to johnbillion:

These properties were introduced in [6851] and [7520].

Since sort and args were technically introduced in WordPress 2.5 and 2.6 respectively, per the linked changes, I wonder if the @since tags should reflect that, rather than showing them as introduced in WordPress 5.7.

Looks good to me otherwise :)

Very good point @SergeyBiryukov. I will defer to @johnbillion and adjust accordingly.

#7 @johnbillion
2 years ago

  • Milestone changed from Future Release to 5.7
  • Owner set to johnbillion
  • Status changed from new to reviewing

#8 follow-up: @johnbillion
2 years ago

Agreed, let's change those @since tags to 2.5.0 and 2.6.0.

#9 in reply to: ↑ 8 @gunnard
2 years ago

Replying to johnbillion:

Agreed, let's change those @since tags to 2.5.0 and 2.6.0.

Fantastic. Updated and pushed.

#10 @johnbillion
2 years ago

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

In 50116:

Taxonomy: Declare and document the sort and args properties of the WP_Taxonomy class.

These properties have been in use since 2.5 and 2.6 but were never added as actual properties on the class. This fixes that.

Props gunnard, SergeyBiryukov

Fixes #52142

#11 follow-up: @johnbillion
2 years ago

Cheers @gunnard! I ended up padding out the detail in the descriptions a bit, as these properties are used in a specific case that's not clear unless you go digging into the code.

#13 in reply to: ↑ 11 @gunnard
2 years ago

Replying to johnbillion:

Cheers @gunnard! I ended up padding out the detail in the descriptions a bit, as these properties are used in a specific case that's not clear unless you go digging into the code

Thank you very much @johnbillion @SergeyBiryukov for the help!

#14 @SergeyBiryukov
2 years ago

In 50119:

Taxonomy: Reorder some WP_Taxonomy properties for consistency.

Follow-up to [48356], [50116].

See #52142.

#15 @desrosj
2 years ago

  • Keywords has-dev-note added

This was mentioned in the miscellaneous developer changes developer note: https://make.wordpress.org/core/2021/02/23/miscellaneous-developer-focused-changes-in-wordpress-5-7/.

Note: See TracTickets for help on using tickets.