Opened 4 years ago

Closed 4 years ago

#9667 closed enhancement (fixed)

Misinformation in the inline code comment documentation for get_term_children

Reported by: simonwheatley Owned by:
Priority: normal Milestone: 2.8
Component: Inline Docs Version:
Severity: minor Keywords: has-patch
Cc:

Description

The inline documentation around get_term_children suggests that it will take a term name, the function argument $term suggests it would take a Term object; neither is true, it takes a term ID and returns an array of term IDs.

I propose the attached patch which changes the function arg name to $term_id, and amends the inline documentation.

The only addition, potentially mildly contentious I suppose, is that the diff uses absint to ensure the term ID passed is definitely an integer.

Attachments (1)

Docs clarification + arg var name change + cast to absint.diff (2.3 KB) - added by simonwheatley 4 years ago.
Docs clarification, arg var name change, term ID arg cast to intval

Download all attachments as: .zip

Change History (7)

  • Keywords has-patch added

I think you should use intval instead of absint. Although term ids are not going to be negative in most cases (thanks to auto-increment), as far as I know nothing precludes them from being negative integers.

Docs clarification, arg var name change, term ID arg cast to intval

Thanks for the suggestion filosofo, diff changed accordingly.

  • Component changed from Taxonomy to Inline Docs
  • Owner ryan deleted

comment:5   ryan4 years ago

  • Milestone changed from Unassigned to 2.8

comment:6   ryan4 years ago

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

(In [11115]) get_term_children phpdoc and var naming improvements. Props simonwheatley. fixes #9667

Note: See TracTickets for help on using tickets.