WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#54065 closed defect (bug) (fixed)

Docs: clarify that `term_id` is a valid value of the `field` parameter of `get_term_by()`

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

Description

In the Parameters section, the text for the first parameter ($field) says:

Either 'slug', 'name', 'id' or 'ID' (term_id), or 'term_taxonomy_id'.

The function accepts ‘term_id’ and it's the actual property name of the WP_Term object, so I guess it should appear first and we should make it more clear that id and ID are aliases.

I’d propose to replace the current docs with something like:

Either 'slug', 'name', 'term_id' (or 'id', 'ID'), or 'term_taxonomy_id'.

(thanks @gazchap for catching this in a DevHub user note)

Attachments (1)

54065.diff (868 bytes) - added by audrasjb 5 months ago.

Download all attachments as: .zip

Change History (4)

@audrasjb
5 months ago

#1 @audrasjb
5 months ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
5 months ago

  • Milestone changed from Awaiting Review to 5.9

#3 @SergeyBiryukov
5 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 51731:

Docs: Сlarify that term_id is a valid value for the $field parameter of get_term_by().

As term_id is the actual property name of the WP_Term, it should appear first and we should make it more clear that id and ID are aliases.

Follow-up to [6254], [25334], [38677], [47865], [47870].

Props gazchap, audrasjb.
Fixes #54065.

Note: See TracTickets for help on using tickets.